Using below logic you can get the auto populated search result (Google search) for your search word
Logic
driver.get("http://www.google.co.in"); driver.findElement(By.name("q")).sendKeys("Test"); List<WebElement> autoPopulatedList=driver.findElements(By.cssSelector("tr>td>span")); for(WebElement ele:autoPopulatedList) { System.out.println(e.getText()); }
Example
Output of given code for above search word is
selenium rc sendkeys
selenium puthon by
selenium
selenium tutorial
selenium ide
selenium webdriver
selenium rc
selenium ide download
selenium grid
selenium documentation
selenium puthon by
selenium
selenium tutorial
selenium ide
selenium webdriver
selenium rc
selenium ide download
selenium grid
selenium documentation
Regards,
SantoshSarma
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.