故事:
在 Java selenium 语言绑定(bind)中有一个 FluentWait
lớp học ,这允许严格控制如何检查预期条件:
Each FluentWait instance defines the maximum amount of time to wait for a condition, as well as the frequency with which to check the condition. Furthermore, the user may configure the wait to ignore specific types of exceptions whilst waiting, such as NoSuchElementExceptions when searching for an element on the page.
换句话说,可以更改应用预期条件检查的轮询间隔,默认为 500 毫秒。另外,可以设置要忽略的异常。
Đúngalso possible in Python , WebDriverWait
类有相关的 poll_frequency
Và ignored_exceptions
参数。
câu hỏi:
在 Protractor/WebDriverJS 中使用 browser.wait()
时,是否可以控制验证预期条件的轮询频率?
theobrowser.wait()
documentation ,只有 3 个可能的参数:一个是预期条件的函数,一个超时值和一个可选的超时错误消息。我希望有不同的设置或方法来更改轮询频率。
在@Kirill S. 的帮助下,经过进一步研究和检查 WebdriverJS
source code ,我可以得出结论,在 javascript selenium 绑定(bind)中没有“轮询频率”这样的东西。无法配置后续条件检查调用之间的间隔 - 它会尽快执行检查。
这与在 Python 或 Java selenium 绑定(bind)中不同,其中在预期条件状态检查之间存在可配置的超时。默认情况下,it would wait for 500ms before the next check :
WebDriverWait by default calls the ExpectedCondition every 500 milliseconds until it returns successfully. A successful return is for ExpectedCondition type is Boolean return true or not null return value for all other ExpectedCondition types.
Tôi là một lập trình viên xuất sắc, rất giỏi!