【问题标题】:selenium webdriver not open Firefox in jenkinsselenium webdriver没有在jenkins中打开Firefox
【发布时间】: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


    【解决方案1】:

    如果您的 jenkins 托管在 Windows 机器上,您应该了解一些允许使用该接口的服务的特殊配置。

    顺便说一句,查看浏览器运行的最简单方法是使用命令行启动 jenkins:

    java -jar jenkins.war
    

    不启动浏览器的主要原因是JNLP(java网络启动协议),当我们执行war时我们可以与桌面应用程序交互。

    【讨论】:

      猜你喜欢
      • 2017-10-23
      • 1970-01-01
      • 2017-08-24
      • 2014-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-25
      • 1970-01-01
      相关资源
      最近更新 更多