gpt4 book ai didi

python - Selenium WebDriver (2.25) 超时不工作

转载 作者:太空狗 更新时间:2023-10-29 20:17:16 24 4
gpt4 key购买 nike

我想我已经阅读了 Stack Overflow 上所有关于 Selenium 超时的问题,但是隐式或显式超时在我的 Selenium webdriver 2.25(Python 2.7 绑定(bind))中都不起作用,而且“no_timeout_here ="两行都将永远挂起 --

browser = webdriver.Firefox()
browser.implicitly_wait(6)
browser.set_page_load_timeout(30)
browser.get("http://www.google.com")
try:
#no_timeout_here = browser.find_element_by_id("id_not_found")
no_timeout_here = WebDriverWait(browser, 5).until(lambda browser:
browser.find_element_by_id("id_not_found"))
except:
raise

将不胜感激所有指点!

10 月 16 日更新

感谢 seleniumnewbie 的全面回答,但是,您的单元测试代码仍然卡在我的 Python 2.7 下的 Ubuntu 11.04(64 位)上 --

(2012/10/17 11:51:58)$ time ./timeout.py 
^CTraceback (most recent call last):
...
KeyboardInterrupt

real 2m26.572s
user 0m0.368s
sys 0m0.232s

(2012/10/17 11:54:26)$ python -V
Python 2.7.2+

(2012/10/17 11:57:04)$ uname -a
Linux 3.0.0-26-generic #43-Ubuntu SMP Tue Sep 25 17:19:22 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

(2012/10/17 11:57:10)$ ls selenium-server-standalone-2.25.0.jar

我可以知道您的操作系统/Python 版本吗?

最佳答案

如果您使用的是 Firefox 17 和 Selenium 2.26.0,那么您遇到了缺陷 #4814:http://code.google.com/p/selenium/issues/detail?id=4814

关于python - Selenium WebDriver (2.25) 超时不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12880024/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com