def set_page_load_timeout(self, time_to_wait):
"""
Set the amount of time to wait for a page load to complete
before throwing an error.
:Args:
- time_to_wait: The amount of time to wait
:Usage:
driver.set_page_load_timeout(30)
"""
try:
self.execute(Command.SET_TIMEOUTS, {
'pageLoad': int(float(time_to_wait) * 1000)})
except WebDriverException:
self.execute(Command.SET_TIMEOUTS, {
'ms': float(time_to_wait) * 1000,
'type': 'page load'})
根据Selenium Python API Docs
set_page_load_timeout(n)
和set_script_timeout(n)
都是timeout方法,用于配置webdriver实例在程序执行期间遵守。在设置“页面”加载“超时”(等待时间)
^{} 设置在引发错误之前等待页面加载完成的时间量,定义为:
在这里您可以找到关于^{} 的详细讨论
设置“脚本”超时(从“时间”到“等待时间”)
^{} 设置在抛出错误之前,^{} (Javascript/AJAX调用)期间脚本应等待的时间量,其定义如下:
^{pr2}$相关问题 更多 >
编程相关推荐