Module 17 Part 1 | Selenium Forum
M
Muhammad Waseem Posted on 09/02/2019

driver.get("http://google.com");
driver.findElement(By.name("q")).sendKeys("hello");

List<WebElement> list = driver.findElements(By.xpath("//ul[@role='listbox']/li"));

System.out.println(list.size());


driver.close();

 

The Above Code is working fine in Debug mode and printing all the elements' size but while executing without debug mode it doesn't print size of elements(No error, no exception but the result is 0).

NOTE: I've also tried this code by putting wait.

 


M
Muhammad Waseem Replied on 09/02/2019

Hello, I have done on my own with so many attempts so you don't need to waste time.

Thanks