Selenium Webdriver - Problem with FirefoxDriver on Debian Lenny (Error No Display)

I use Selenium to check my website, it opens the URL using Firefox, logs in and does some things on the page, and then logs out and disables firefox. All this works fine on Windows 7. The code starts with:

WebDriver driver = new FirefoxDriver(); driver.get(URL); 

Now I deployed my jar in the linux box, which runs Debian lenny, which has iceweasel on it. The cron task runs a program that produces the following error when trying to open firefox:

org.openqa.selenium.firefox.NotConnectedException: cannot connect to host 127.0.0.1 on port 7055 after 45000 ms. Exit to the Firefox console: Error: cannot open display :: 0 Error: cannot open display :: 0

in org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start (NewProfileExtensionConnection.java:106) in org.openqa.selenium.firefox.FirefoxDriver.startClient (FirefoxDriver.java:244) in org.openqote.reenweote . (RemoteWebDriver.java:110) in org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:190) at org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:183) at org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:179) at org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:92) in auth.Authenticator.authenticate (Authenticator.java:15) in reader.ReaderThread.run (ReaderThread.java:67) org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary (/ usr / bin / firefox) on port 7055; process output: Error: cannot open display :: 0 Error: cannot open display :: 0

Assembly Information: version: 'unknown', version: 'unknown', time: 'unknown' System information: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.26-2 -686 ', java.version:' 1.6.0_26 'Driver information: driver.version: FirefoxDriver at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start (NewProfileExtensionConnection.java:118) in org.openqa.selenium. firefox.FirefoxDriver.startClient (FirefoxDriver.java:244) in org.openqa.selenium.remote.RemoteWebDriver. (RemoteWebDriver.java:110) in org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:190) at org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:183) at org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:179) at org.openqa.selenium.firefox.FirefoxDriver. (FirefoxDriver.java:92) in auth.Authenticator.authenticate (Authenticator.java:15) in reader.ReaderThread.run (ReaderThread.java:67)

Xvfb works fine for me in the box, and I set the DISPLAY variable to 0. I searched around and none of the solutions (for example, setting the env variable) worked.

Is it assumed that Isnt XVfb works as a non-graphical environment in which the browser starts up and takes the necessary actions? What stops its launch?

I am using the latest version of Selenium version 2.31 and Firefox 3.0.6 Iceweasel.

Edit: Updated to Firefox 14 and still sees the same problem. I even increased the timeout to 60 seconds.

driver.manage (). timeouts (). pageLoadTimeout (60, TimeUnit.SECONDS);

SOLVED:. Running it using the xvfb shell, execute xvfb as follows:

 export DISPLAY=:0.0 xvfb-run --auto-servernum --server-num=0 nohup java - jar X.jar 
+6
source share
4 answers

Having solved this:

 export DISPLAY=:0.0 xvfb-run --auto-servernum --server-num=0 nohup java - jar X.jar 
+2
source

Try updating your webdriver or downgrade your firefox. this problem is because the selenium server cannot connect to your firefox.

0
source

I saw a similar problem, and this only happens for firefox, everything works fine for another browser, I tried Chrome. Here is the solution for this 1. Check the version of FF, if it is the latest, then go to the smaller version of FF. Recommended for greater stability. 2. And you should always try to get the last selenium binar from the site of selenium. For more details try this solution: http://khyatisehgal.wordpress.com/2014/09/09/at-org-openqa-selenium-firefox-internal-newprofileextensionconnection-startnewprofileextensionconnection-java106/

-1
source

This problem will be resolved after upgrading to the latest Selenium cans.

-2
source

All Articles