我有一个
Java应用程序,使用Selenium Webdriver登录到一个站点,检查特定的文本,如果找到它们给我发电子邮件.我有一个cron作业,每天早上运行jar文件,每晚都停止它.
它使用firefox但运行无头,这是命令
xvfb-run –auto-servernum –server-num = 0 nohup /usr/bin/java -jar A.jar
当它试图打开Firefox时,抛出以下内容:
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.(RemoteWebDriver.java:110)
at 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)
at auth.Authenticator.(Authenticator.java:27)
at reader.ReaderThread.run(ReaderThread.java:70)
奇怪的是,当我使用x2go并登录debian框时,程序运行正常.我可以看到Firefox打开,登录并尽其所能.
我正在使用Firefox 14的2.31版本,正如我所说,当我产生桌面会话并登录到盒子时它可以正常工作.
知道为什么它不起作用吗?我想我现在可以更新到2.32但是我不认为这是问题,因为它在某些情况下可以正常工作而在其他情况下并不适用.
P.S如果我让它在我的Windows eclipse实例中运行,它没有任何问题.
在此先感谢您的帮助