I’m opening a discord channel and busy looping reading messages from it with the below statement to get the elements:
List<org.openqa.WebElement> ret = driver.findElement(By.tagName("main")) // driver = WebDriver .findElements(By.tagName("li")) .stream() .filter(message -> message.getAttribute("id") != null && message.getAttribute("id").contains("chat-messages")) .toList();
There are about 40 messages by default shown on the page, and it takes 5-6 seconds for every read. It is unacceptably long. I read that when there are no matches, findElements has an implicit wait time, but that is not the case here as there are elements returned in every read. Any idea what is causing this delay and how to improve it?
Read more here: Source link