I am currently writing some automated tests using Selenium in Java to test a search engine and its results in a webpage, but I have noticed that the findElement calls tend to run pretty slow. I use this call a lot as I iterate through the displayed results to make sure that they are displaying properly (As well as a few other tests).
I want to know if there is a faster method I could use, or if there are other recommendations out there for speeding up this process.
Example calls:
driver.findElement(By.xpath("//section[@id='results']/ul/li[1]/a/h1")).click(); // choose first result
driver.findElement(By.className("total"));
I am wondering if perhaps the By.xpath
function is slower than the other functions such as the By.className
function. I'm relatively new to automated testing, but I feel like the tests I am running shouldn't be as slow as they are. Any help is appreciated. Thanks!