Saturday 23 January 2016

How to enter the value to text box and select from suggestion drop down box


Consider the below example


Ex: https://www.google.co.in


While try to enter the any string in  google text box for searching, we are getting the suggestion drop down box. Here we need to select the value from drop down box and click search button.

use below lines of code

driver.findElement(By.id("gs_htif0)).sendKeys("Selenium Automation"+"\n");



Here, sendKeys("Selenium Automation"+"\n")

we should use "\n" for handle this issue. Its used for send the ENTER keys for click the button.

No comments:

Post a Comment