Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 詹金斯建筑公司;浏览器不在linux上启动,但在本地计算机上运行_Java_Linux_Selenium_Jenkins - Fatal编程技术网

Java 詹金斯建筑公司;浏览器不在linux上启动,但在本地计算机上运行

Java 詹金斯建筑公司;浏览器不在linux上启动,但在本地计算机上运行,java,linux,selenium,jenkins,Java,Linux,Selenium,Jenkins,我可以从本地机器(WindowsA)成功运行selenium webdriver测试,现在我想使用Jenkins(机器B)运行测试。对于我的webdriver测试,我看到Jenkins的以下输出 org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows: Error: no di

我可以从本地机器(WindowsA)成功运行selenium webdriver测试,现在我想使用Jenkins(机器B)运行测试。对于我的webdriver测试,我看到Jenkins的以下输出

org.openqa.selenium.WebDriverException: 
Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows: 
Error: no display specified

我已确保浏览器和selenium版本匹配。我认为这是我的Jenkins(linux)机器的问题。我的linux机器上也有
Xvfb
。我读过一些文章提到浏览器可能在无头模式下运行,但鉴于其他人正在使用Jenkins,我在进行任何更改之前都会保持谨慎。

看起来您试图在不指定a的情况下运行测试,根据我在您的问题中读到的内容,我不确定您是否真的在使用Xvfb以及“机器B”是否有X服务器。如果机器B没有X服务器,则需要运行Xvfb以模拟X服务器,然后需要将$DISPLAY环境变量设置为Xvfb服务器将侦听的值,最后可以运行selenium驱动程序。例如:

# The Xvfb server will listen for connections as server number 4
Xvfb :4 &
# set $DISPLAY value to the one defined in your Xvfb server instance
export DISPLAY=:4
# run the selenium driver
java -jar /path/to/your/driver/selenium-server-standalone-2.44.0.jar

您正在使用哪些命令来运行selenium测试?“clean test”。如果我使用“mvn clean test”,会为maven显示一条错误消息。看起来您没有启动Xvfb。也许这会有帮助:有没有一种方法可以设置Jenkins的显示?检查这个问题。所以我应该以您的例子(或类似的例子)为例,使用Jenkins进行注入。安装selenium独立服务器。应该是这样的吗?您必须根据您的具体情况调整这些命令,因为您没有确切解释您当前如何尝试运行测试,在jenkins中有很多方法可以做到这一点,比如使用简单的bash脚本/TaskRunner/插件,我无法准确地告诉您该做什么。目前,我使用mvn clean test从本地计算机命令行运行测试。我的项目由maven testng selenium和一些javascript组成