5

I have a java app that uses the Selenium Webdriver to login to a site, check for specific texts and email me if it finds them. I have a cron job that runs the jar file every morning and stops it every night.

It uses firefox but runs headless, this is the command

xvfb-run --auto-servernum --server-num=0 nohup /usr/bin/java -jar A.jar

When it attempts to open Firefox the below is thrown:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
 *** Item Installed via directory addition to Install Location: app-global Item ID: {972ce4c6-7e08-4474-a285-3208198ce6fd}, attempting to register...
 *** Item Installed/Upgraded at Install Location: app-global Item ID: {972ce4c6-7e08-4474-a285-3208198ce6fd}, attempting to register...
 *** Blocklist::_loadBlocklist: no XML File found
*** ... success, item is compatible
*** Item Installed via directory addition to Install Location: app-profile Item ID: fxdriver@googlecode.com, attempting to register...
*** Item Installed/Upgraded at Install Location: app-profile Item ID: fxdriver@googlecode.com, attempting to register...
*** ... success, item is compatible at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:106)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:190)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:183)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:179)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:92)
    at auth.Authenticator.<init>(Authenticator.java:27)
    at reader.ReaderThread.run(ReaderThread.java:70)

The weird thing is that when I use x2go and login to the debian box, the program works fine. I can see Firefox opening, logging in and doing everything as it should.

I am using the 2.31 version with Firefox 14 and as I said, it works ok when I spawn a desktop session and login to the box.

Any idea why it doesnt work? I guess I could update to 2.32 now that it's out but I dont think that's the issue as it works ok in some cases and doesnt in others.

P.S If I leave it running in my Windows eclipse instance, it doesnt have any issues.

Thanks in advance for any help

1 Answers1

0

Are you passing the DISPLAY parameter? I found Firefox would balk without it (when running headless)

Xvfb :0 -ac -screen 0 1024x768x24 &