【发布时间】:2015-01-29 08:07:40
【问题描述】:
詹金斯版本:1.598
硒版本:1.42.2
火狐版本:2.7
平台:windows2008和windows2003
webtest.py
from selenium import webdriver
class Webtest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
...
我在windows cmd中使用了“python webtest.py”命令,没关系
d:\python webtest.py
.
--------------------------------------------------
Ran 1 test in 42.978s
OK
但是,如果在jenkins中,选择“执行windows批处理命令”并配置“python webtest.py”,有问题,firefox没有打开,但是有进程,
同时,webtest也出现了各种各样的问题,例子:
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\webelement.py", line 370, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 173, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium-2.42.1-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
StaleElementReferenceException: Message: u'Element not found in the cache - perhaps the page has changed since it was looked up' ;
但是,windows cmd中的webtest.py执行成功了。
所以,我不知道为什么?如何让浏览器打开?谢谢
【问题讨论】:
标签: firefox selenium jenkins webdriver