Issue
I have tried entering the complete field value using selenium but this doesn't work. It requires to select from the suggestion shown. Anyone knows how to select from the suggestion show.
Note: I am using hybrid framework.
Solution
something like the below one? If yes, replace Thread.sleep with explicit waits.
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.co.in/maps?source=tldso");
Thread.sleep(3000);
driver.findElement(By.id("searchboxinput")).sendKeys("Kora");
Thread.sleep(3000);
List<WebElement> autoSuggestions=driver.findElement(By.className("sbsb_b")).findElements(By.tagName("li"));
for (WebElement suggestions : autoSuggestions) {
if (suggestions.getText().contains("Koramangala Police Station")) {
suggestions.click();
Thread.sleep(3000);
break;
}
}
driver.quit();
Answered By - shank087
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.