我想我已经阅读了 Stack Overflow 上的所有 Selenium 超时问题,但隐式或显式超时在我的 Selenium webdriver 2.25(Python 2.7 绑定)中都不起作用,并且“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 的全面回答,您的单元测试代码仍然挂在我的 Ubuntu 11.04(64 位)上的 Python 2.7 上 -
(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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)