如何在Python中为Selenium Webdriver设置脚本超时?
在Java的Webdriver.Timeouts中,有三种超时函数:
- 隐式等待(implicitlyWait)
- 页面加载超时(pageLoadTimeout)
- 脚本超时(setScriptTimeout)
我想找找第三个在Python中的对应函数,但没找到。以下是前两个在Python中的对应写法:
- implicitly_wait(10)
- set_page_load_timeout(20)
1 个回答
10
这是你在找的东西吗:
set_script_timeout(time_to_wait)
Set the amount of time that the script should wait during an
execute_async_script call before throwing an error.
Args :
time_to_wait: The amount of time to wait (in seconds)
Usage :
driver.set_script_timeout(30)
参考 - set_script_timeout