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.
Hello, I have done on my own with so many attempts so you don't need to waste time.
Thanks