TimeoutException while instantiating PhantomJSDriver on Linux server

I have a strange Exception ( java.util.concurrent.TimeoutException: null

) when trying to create a PhantomJSDriver (version 1.9.8) in a backend application on a Linux server. This same application works without issue on my local Mac.

An exception:

ERROR 12721 --- [http-nio-9095-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] :
Servlet.service() for servlet [dispatcherServlet] in context with
path [] threw exception [Request processing failed; nested 
exception is 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: 'unknown', revision: 'unknown', time: 'unknown'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: 
'3.12.9-2-ARCH', java.version: '1.8.0_25'
Driver info: driver.version: PhantomJSDriver] 
with root cause 

java.util.concurrent.TimeoutException: null 
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:107)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:96)

      

Source code causing this issue:

DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
String [] phantomJsArgs = {"--ignore-ssl-errors=yes", "--ssl-protocol=any"};
capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomJsArgs);
PhantomJSDriver driver = new PhantomJSDriver(capabilities); // <--- here exception is thrown

      

+3


source to share


1 answer


Your actual problem is above:

Request processing error; Nested Exception - org.openqa.selenium.remote.UnreachableBrowserException: Failed to start a new session. Possible reasons are the wrong address of the remote server or the unsuccessful launch of the browser.



Selenium cannot find or launch your browser (which explains why it works on one machine but not another). Is the browser installed on this Linux server? Is the Selenium user running with rights to run it?

0


source







All Articles