2014-10-02 150 views
1

我使用Selenium和GhostDriver和PhantomJS從Java Web應用程序截取網頁截圖。Selemium和PhantomJS - 超時等待驅動程序服務器啓動

我不知道爲什麼我得到這個錯誤。我懷疑PhantomJSDriver正在使用服務器的公共IP,也許防火牆不滿意...

該項目在我的本地計算機(OSX)上沒有任何問題,但服務器上沒有任何問題(Debian 7)。

2014-10-02 12:29:49,089 [ajp-8009-3] ERROR HibernateFilter - exception caught in hibernate filter for request 
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47' 
System info: host: 'debian', ip: '8.8.8.8', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-028stab093.2', java.version: '1.6.0_ 
31' 
Driver info: driver.version: PhantomJSDriver 
     at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593) 
     at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240) 
     at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126) 
     at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139) 
     at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:110) 
     at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:99) 
     at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:89) 
     at ... 
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. 
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. 
Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47' 
System info: host: 'debina', ip: '8.8.8.8', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-028stab093.2', java.version: '1.6.0_31' 
Driver info: driver.version: PhantomJSDriver 
     at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165) 
     at org.openqa.selenium.phantomjs.PhantomJSCommandExecutor.execute(PhantomJSCommandExecutor.java:78) 
     at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572) 
     ... 36 more 
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:14083/status] to be available after 20007 ms 
     at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104) 
     at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163) 
     ... 38 more 
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException 
     at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143) 
     at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79) 
     ... 39 more 
Caused by: java.util.concurrent.TimeoutException 
     at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:258) 
     at java.util.concurrent.FutureTask.get(FutureTask.java:119) 
     at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130) 
     ... 40 more 

編輯

,我發現,UnreachableBrowserException該主機與IP從InetAddress.getLocalHost().getHostAddress()InetAddress.getLocalHost().getHostName()都來了。

超時實際上來自本地主機地址Timed out waiting for [http://localhost:12518/status] to be available after 20010 ms

+0

你確定你的服務器配置正確嗎?我認爲它的IP地址不應與Google DNS服務器相同:'ip:'8.8.8.8''。 – 2014-10-02 14:13:52

+0

是的,它的配置。我只是改變了IP :) – Charles 2014-10-02 14:21:00

回答

0

我有一個類似的問題,但它與超時無關,即使該消息很接近。事實上,這是由於ghost驅動程序無法創建其日誌文件。

檢查您的日誌中是否有此消息,如果有,請嘗試更改權限以檢查。

相關問題