如何在Python中使用Selenium Webdriver设置脚本超时?

时间:2014-04-22 23:20:38

标签: python selenium selenium-webdriver

Wedriver.Timeouts中有三种Java超时函数:

  1. implcitlyWait
  2. pageLoadTimeout
  3. setScriptTimeout
  4. 我试图查找python相当于第三个,但我无法找到它。以下是前两个的python等价物。

    1. implicitly_wait(10)
    2. set_page_load_timeout(20)

1 个答案:

答案 0 :(得分:3)

这就是你要找的东西:

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