简体   繁体   中英

How to speed up findElement() in Selenium?

driver.findElement(...); and driver.findElements(...); take both about 50ms to execute. I tried to set the implicit wait to 0 with

driver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS);

but I have still the ~50ms delay. What could I try to speed up my program?

Instead finding element in the driver, you could narrow the scope to a particular Element and find inside the Element scope which will be much faster.

This element could be at any higher hierarchy(parent level) from the ones you would want to look for in your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM