Selenium WebDriver(2.25)超时不起作用 [英] Selenium WebDriver (2.25) Timeout Not Working

查看:157
本文介绍了Selenium WebDriver(2.25)超时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I think I've read all the Selenium timeout questions on Stack Overflow, yet neither implicit nor explicit timeout works in my Selenium webdriver 2.25 (Python 2.7 binding) and both "no_timeout_here =" lines would hang forever --

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位)上-

Thanks to seleniumnewbie for your comprehensive answer, however, your unittest code still hangs on my Ubuntu 11.04 (64-bit) under 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

我可以知道您的OS/Python版本吗?

May I know your OS/Python version?

推荐答案

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

If you are using Firefox 17 and Selenium 2.26.0 then you are hitting defect #4814: http://code.google.com/p/selenium/issues/detail?id=4814

这篇关于Selenium WebDriver(2.25)超时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆