Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99411

Autocomplete text-box first option selection

$
0
0

I want to select the first option showing in an autocomplete text box. Below is the code which i tried but not getting the required output.

Code:

public void clickSublink() throws IOException, InterruptedException {   
    System.setProperty("webdriver.chrome.driver","F:\\Amitha\\chromedriver.exe");
    WebDriver dr=new ChromeDriver();
    dr.get("http://demoqa.com/autocomplete/");
    dr.findElement(By.xpath("//input[@id='tags']")).sendKeys("b");
    dr.findElement(By.xpath("//ul[@id='ui-id-1']//child::li")).click();
}

Viewing all articles
Browse latest Browse all 99411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>