java - Is there a faster method to get elements than the findElement method in Selenium? -
i writing automated tests using selenium in java test search engine , results in webpage, have noticed findelement calls tend run pretty slow. use call lot iterate through displayed results make sure displaying (as few other tests).
i want know if there faster method use, or if there other recommendations out there speeding 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 wondering if perhaps by.xpath
function slower other functions such by.classname
function. i'm relatively new automated testing, feel tests running shouldn't slow are. appreciated. thanks!
i ended using findelements()
function , iterating through generated list. lot of repetitive tasks needed perform check formatting of search results being kept in lists in html. findelements()
useful because needed go webpage 1 (with initial call) , iterations , operations performed on executed in memory.
the findelements()
useful checking lack of elements, per selenium documentation @ https://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/webelement.html. after making changes tests, saw average speedup of %30 (though of smaller tests, changes negligible...)
Comments
Post a Comment