简体   繁体   中英

Jenkins build fails & browser does not launch on linux but runs on local machine

I can successfully run my selenium webdriver tests from my local machine(WindowsA), I now want to run my tests using Jenkins (machine B). For my webdriver Tests I see the following output from Jenkins

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

I've made sure browser and and selenium versions match. I think this is an issue with my Jenkins(linux) machine. I have Xvfb on my linux machine also. I've read articles mention the browser maybe running in HEADLESS mode but seeing as other people are using Jenkins I am cautious before making any changes.

Looks like you are trying to run the tests without specifying a DISPLAY and from what I read in your question I'm not sure if you are really using Xvfb or not and also if the "machine B" has a X server or not. Well, if machine B doesn't has a X server you need to run Xvfb in order to simulate one, then you need to set the $DISPLAY environment variable to the value that the Xvfb server will be listening to and finally you can run the selenium driver. An example:

# 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM