Module 17 Part 1 | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos
10% April Month Discount Avail now

Selenium Training Forum

Module 17 Part 1

M
Muhammad Waseem Post 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 Reply on 09/02/2019

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

Thanks