cscan
cscan

Reputation: 3840

PhantomJS driver wont start

I'm having issues starting up the PhantomJS driver. It works just fine on my local machine (OSX) but I'm having issues getting it started on the server (Linux).

Here's the code that causes the issue:

DesiredCapabilities dcap = new DesiredCapabilities();
String[] phantomArgs = new  String[] { "--webdriver-loglevel=NONE" };
dcap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomArgs);
dcap.setCapability("phantomjs.binary.path", "/usr/local/bin/phantomjs");
WebDriver driver = new PhantomJSDriver(dcap);

And here's the stack trace of the issue:

[ERROR] [09/09/2015 18:32:45.517] [pipeline-akka.actor.default-dispatcher-11] [akka://pipeline/user/$u] 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: host: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
Driver info: driver.version: PhantomJSDriver
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: host: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
Driver info: driver.version: PhantomJSDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:589)
        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 com.example.p.Test.ingest(GoogleGetLinksPipe.java:48)
        at com.example.p.Test.ingest(GoogleGetLinksPipe.java:22)
        at com.example.p.AbstractPipe.onReceive(AbstractPipe.java:39)
        at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:167)
        at akka.actor.Actor$class.aroundReceive(Actor.scala:467)
        at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:97)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
        at akka.actor.ActorCell.invoke(ActorCell.scala:487)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
        at akka.dispatch.Mailbox.run(Mailbox.scala:220)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
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:568)
        ... 20 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:8092/status] to be available after 20000 ms
        at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
        at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
        ... 22 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)
        ... 23 more
Caused by: java.util.concurrent.TimeoutException
        at java.util.concurrent.FutureTask.get(Unknown Source)
        at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
        ... 24 more

I built the PhantomJS from source and had it working before - it ran through the tests just fine. Additionally, it works locally on my machine. Any thoughts on what could be causing the issue?

Upvotes: 0

Views: 2645

Answers (1)

cscan
cscan

Reputation: 3840

The problem was due to the phantomjs's inability to write to the log file. Changing the file permissions of the log file resolved the issue.

Upvotes: 2

Related Questions