简体   繁体   中英

How to access Google ajax data using Java/Selenium

I am using Selenium Webdriver/Java. And I have given input "iphone" in google search box.

But I want to select "iphone 6" from the list shown by google search. How can I do that using Java/Selenium Webdriver?

Please refer to this link for further understanding

How about

List<WebElement> options = driver.findElements(By.cssSelector("[role='option']"));
for (WebElement w: options)
    if (w.getText().equals("iphone 6")){
        w.click();
        break;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM