driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS) does not working

这一生的挚爱 提交于 2020-01-05 03:37:14

问题


driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

The above implicity wait code is not working for me on Google chrome. I have tried with selenium 2.47 and 2.53.1


回答1:


You should read up on what implicit wait actually does and how it works.

http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp#implicit-waits

It's not something that you call to wait for 10 seconds, it only comes into play when an element that is being searched for is not available... then the implicit wait is triggered and that element is polled up to the 10s. If the element is already there, then there is no wait time. Thread.sleep() pauses execution no matter what but is not a good practice.




回答2:


An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements (if) they are not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object instance.



来源:https://stackoverflow.com/questions/41143520/driver-manage-timeouts-implicitlywait10-timeunit-seconds-does-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!