简体   繁体   English

Jenkins-Selenium WebDriver Firefox错误-无法连接

[英]Jenkins - Selenium WebDriver Firefox error - Failed to connect

I have Jenkins on a CentOS machine. 我在CentOS机器上安装了Jenkins。

I installed all required plugins, configured my Jenkins project. 我安装了所有必需的插件,并配置了我的Jenkins项目。

Jenkins runs the tests with firefox on the local machine(Selenium 2.44/Firefox 31) . Jenkins在本地计算机(Selenium 2.44 / Firefox 31)上使用firefox运行测试。 No RC control or XVFB plugins. 没有RC控件或XVFB插件。

The X server is started and DISPLAY is set to 0.0 X服务器已启动,并且DISPLAY设置为0.0

  • The source code, come from a SVN repository 源代码来自SVN存储库
  • I use ANT for the build 我使用ANT进行构建

Everything worked fine, the tests run properly with Jenkins . 一切正常,测试与Jenkins一起正常运行 And now, from one day to the next, all tests fail for no reasons. 现在,从一天到第二天,所有测试均无故失败。 I changed nothing in the configurations. 我没有更改配置。

[mkdir] Created dir: /var/lib/jenkins/jobs/myTestProject/workspace/report
[mkdir] Created dir: /var/lib/jenkins/jobs/myTestProject/workspace/report/xml
[junit] Running test.TestConnection
[junit] Tests run: 1, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 46,24 sec
[junit] Error: 
[junit] org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
[junit] Error: no display specified
[junit] Error: no display specified
[junit] 
[junit]     at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
[junit]     at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
[junit]     at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
[junit]     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
[junit]     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
[junit]     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
[junit]     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
[junit]     at tools.WebDriverInitHelper.initDriver(Unknown Source)
[junit]     at tools.TestBase.before(Unknown Source)
[junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[junit]     at java.lang.reflect.Method.invoke(Method.java:606)
[junit]     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
[junit]     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
[junit]     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
[junit]     at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
[junit]     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
[junit]     at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
[junit]     at org.junit.rules.RunRules.evaluate(RunRules.java:20)
[junit]     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
[junit]     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
[junit]     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
[junit]     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
[junit]     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
[junit]     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
[junit]     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
[junit]     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
[junit]     at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
[junit]     at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38)
[junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:532)
[junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1179)
[junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1030)

I don't understand what happened. 我不明白发生了什么。 Firefox has not updated. Firefox尚未更新。

Do you have any suggestions ? 你有什么建议吗 ?

I found the solution : Error: cannot open display: :0 for Selenium tests 我找到了解决方法: 错误:无法打开显示:硒测试::0

1.Open Jenkins shell script located at: /etc/init.d/jenkins. 1.打开位于/etc/init.d/jenkins的Jenkins shell脚本。

2.Add the following lines as follows before PATH variable: 2.在PATH变量之前添加以下几行:

  • /usr/bin/X :0 vt7 -ac / usr / bin / X:0 vt7 -ac

  • export DISPLAY=:0 出口DISPLAY =:0

  • xhost + xhost +

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Jenkins中运行Selenium Webdriver时出错 - Error on Running Selenium Webdriver in Jenkins 没有在Selenium WebDriver上加载Firefox - Not loading firefox on selenium webdriver Jenkins -Selenium Webdriver-Java:错误:DevToolsActive端口未退出 - Jenkins -Selenium Webdriver-Java: Error : DevToolsActive port does not exit 硒-WebDriver-Firefox 64位Linux - selenium - webdriver - firefox 64 bit linux 未知错误:Chrome 无法启动:异常退出。 Chrome 未在 selenium webdriver 中打开 - unknown error: Chrome failed to start: exited abnormally. Chrome isn't opening in selenium webdriver Selenium Webdriver测试在Jenkins(** Linux **)上失败,“驱动程序不可执行” - Selenium Webdriver Tests fail on Jenkins(**Linux**) “The driver is not executable” selenium webdriver.Firefox 无法为非 sudo 用户启动 - selenium webdriver.Firefox not starting for non-sudo user Firefox Webdriver Selenium“未指定协议”,Debian(Wheezy),服务,脚本 - Firefox Webdriver Selenium “No protocol specified” , Debian(Wheezy) , Service , Script selenium webdriver在带firefox浏览器的无头Linux上使用python在下拉菜单中选择一个选项 - selenium webdriver select an option in dropdown menu using python on headless Linux with firefox browser cURL返回响应,但在尝试使用Selenium Firefox Webdriver访问时无法获得相同的响应 - cURL returns response but unable to get the same response when tried to access using selenium firefox webdriver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM