mardi 16 mars 2021

To find the xpath of dropdown list of languages in Google sign in

Dropdown button of Signin page

On clicking the dropdown button , languages are displayed . I want to store all these languages in a list and then iterate using the for loop so that I can select one.

I tried so many ways to create dynamic xpath but it returns me "0" when I check for the size of the list.

Here is the code driver.get("https://ift.tt/2P4Bhxy);                  driver.findElement(By.xpath("//span[contains(text(),'‪English (United States)‬')]")).click();                  List list = driver.findElements(By.xpath("//div[@jsname='V68bde']//div"));                  System.out.println(list.size());

Thanks for the help in advance!

Aucun commentaire:

Enregistrer un commentaire