Error Cannot Open Display 99
Contents |
here for a quick overview of the site Help
Error Can T Open Display
Center Detailed answers to any questions you might have Meta xt error can t open display Discuss the workings and policies of this site About Us Learn more about Stack
Firefox Console Output Error Cannot Open Display
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question xhost: unable to open display ":0" x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Selenium Webdriver - Issue with FirefoxDriver: Error: cannot open display: :0.0 up vote 3 down vote xvfb-run selenium favorite 1 I made a test case in selenium which automatically opens Firefox and do its login stuffs. I made this using java programming through Eclipse.& i tested it is working fine in my windows7 system. And Now, the problem is A cron job starts this same program in the server, which throws the following error when trying to open firefox: Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec ------------- Standard Error ----------------- org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: Error: cannot open display: :0.0 Error: cannot open display: :0.0 at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnectio n.java:118) at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:250) at org.openqa.selenium.remote.RemoteWebDriver.
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site
Extension Randr Missing On Display 99
About Us Learn more about Stack Overflow the company Business Learn more about xvfb cannot open display hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Xvfb-run Example
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Xvfb & Docker - http://stackoverflow.com/questions/21827531/selenium-webdriver-issue-with-firefoxdriver-error-cannot-open-display-0-0 cannot open display up vote 2 down vote favorite 1 I need to run XVFB and docker with firefox but can't get them to work together Here is my Dockerfile : FROM abevoelker/ruby:latest # based on ubuntu ENV TERM linux RUN apt-get update && apt-get install -y ..... ENV DISPLAY :99 # Install Xvfb init script ADD xvfb_init /etc/init.d/xvfb # default xvfb init.d RUN chmod http://stackoverflow.com/questions/32151043/xvfb-docker-cannot-open-display a+x /etc/init.d/xvfb CMD ["firefox"] The error message I get from Firefox is Error: cannot open display: :99 firefox docker dockerfile xvfb share|improve this question asked Aug 22 '15 at 0:22 overlox 325114 2 what about CMD["xvfb_run firefox"] –Michael Aug 22 '15 at 0:28 Hi Michael, thanks for your help ! The problem is that the real idea behind this is to launch selenium webdriver with firefox, in a ruby program, therefore I can't use xvfb_run –overlox Aug 22 '15 at 11:34 2 I use xvfb_run exactly for that - xvfb_run bundle exec cucumber --profile jenkins –Michael Aug 23 '15 at 17:57 1 are you running in MacOS ? –Rico Aug 25 '15 at 0:47 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted I solved this by writing a startup script which will: - start xvfb - start firefox By calling it using the RUN command, xvfb will be started when the container starts. Dockerfile ... ENV DISPLAY :99 ADD run.sh /run.sh RUN chmod a+x /run.sh CMD /run.sh run.sh Xvfb :99 -screen 0 640x480x8 -nolisten tcp & firefox share|improve this answer answered S
the Xvfb framebuffer so that we can run it on our continuous integration agents which don't have a display attached. The first thing we needed to do was set the environment property ‘webdriver.firefox.bin' to our own http://www.markhneedham.com/blog/2011/12/15/webdriver-getting-it-to-play-nicely-with-xvfb/ script which would point the display to Xvfb before starting Firefox: import java.lang.System._ lazy val firefoxDriver: FirefoxDriver = { setProperty("webdriver.firefox.bin", "/our/awesome/starting-firefox.sh") new FirefoxDriver() } Our first version of the script looked like this: /our/awesome/starting-firefox.sh #!/bin/bash http://jenkins-ci.361315.n4.nabble.com/Error-cannot-open-display-0-0-td2288363.html rm -f ~/.mozilla/firefox/*/.parentlock rm -rf /var/go/.mozilla XVFB=`which xVfb` if [ "$?" -eq 1 ]; then echo "Xvfb not found." exit 1 fi $XVFB :99 -ac & BROWSER=`which firefox` if [ "$?" open display -eq 1 ]; then echo "Firefox not found." exit 1 fi export DISPLAY=:99 $BROWSER & The mistake we made here was that we started Xvfb in the background which meant that sometimes it hadn't actually started by the time Firefox tried to connect to the display and we ended up with this error message: No Protocol specified Error cannot open display :99 We really wanted to keep Xvfb running regardless of t open display whether the Firefox instances being used by WebDriver were alive or not so we moved the starting of Xvfb out into a separate script which we run as one of the earlier steps in the build. We also struggled to get the FirefoxDriver to kill itself after each test as calling ‘close' or ‘quit' on the driver didn't seem to kill off the process. We eventually resorted to putting a ‘pkill firefox' statement at the start of our firefox starting script: /our/awesome/starting-firefox.sh #!/bin/bash rm -f ~/.mozilla/firefox/*/.parentlock rm -rf /var/go/.mozilla pkill firefox BROWSER=`which firefox` if [ "$?" -eq 1 ]; then echo "Firefox not found." exit 1 fi export DISPLAY=:99 $BROWSER & It's a bit hacky but it does the job more deterministically than anything else we've tried previously. Be Sociable, Share! Tweet Written by Mark Needham December 15th, 2011 at 11:19 pm Posted in Software Development Tagged with webdriver « WebDriver: Getting it to play nicely with jQuery ColorBox The Lean Startup: Book Review » Rob Hunter The `xvfb-run` script that ships with most Linux distributions is useful in these situations. xvfb-run -auto-servernum my-build-script This starts an X display, runs `my-build-script`, then closes the X display. X authentication, exit codes, and the process tree are all taken care of.
| Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Error: cannot open display: :0.0 Hello, I'm using Selenium with Hudson to test a PHP project on Ubuntu Linux. As my regular user, I can run my ant script and selenium-rc opens firefox, runs some tests, and everything works. [exec] PHPUnit 3.4.14 by Sebastian Bergmann. [exec] [exec] . [exec] [exec] Time: 5 seconds, Memory: 5.75Mb [exec] [exec] OK (1 test, 0 assertions) When I run the script in Hudson, I get this error: [exec] PHPUnit 3.4.14 by Sebastian Bergmann. [exec] [exec] E [exec] [exec] Time: 21 seconds, Memory: 5.75Mb [exec] [exec] There was 1 error: [exec] [exec] 1) Example::testMyTestCase [exec] PHPUnit_Framework_Exception: Response from Selenium RC server for getNewBrowserSession(*firefox, http://dsat.test). [exec] Failed to start new browser session: Error while launching browser. [exec] [exec] [exec] [exec] FAILURES! [exec] Tests: 1, Assertions: 0, Errors: 1. If I sudo su hudson and try to run the ant script, I get the same errors. If I try to start firefox as the hudson user, I get this: $ firefox No protocol specified No protocol specified Error: cannot open display: :0.0 Any ideas on why this is happening? What about the hudson user is preventing it from using display? I installed Hudson with these steps this morning (which apparently created the hudson user): wget -q -O - http://hudson-labs.org/debian/hudson-labs.org.key| sudo apt-key add - echo "deb http://hudson-labs.org/debianbinary/" | sudo tee -a /etc/apt/sources.list sudo apt-get update sudo apt-get install hudson Thanks for your help, Mike Sami Tikka Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Error: cannot open display: :0.0 For obvious security reasons, access to the X server is restricted to only the user who has logged in on the console. Your options: