-1

I am using PhantomJs with Selenium for headless automation. It worked well for me until today. Now, I am getting the below exception when I am initializing the PhantomJs driver.

The code I am using is as follows:

Capabilities caps = new DesiredCapabilities();
((DesiredCapabilities) caps).setJavascriptEnabled(true);
((DesiredCapabilities)caps).setCapability("phantomjs.binary.path", System.getProperty("user.dir")
                + "\\src\\main\\resources\\phantomjs.exe");

WebDriver driver = new PhantomJSDriver(caps);

ERROR:

 Jul 27, 2016 9:20:01 PM
org.openqa.selenium.phantomjs.PhantomJSDriverService  INFO:
executable: C:\Users\Ajatshatru
Singh\workspace\Assignment\src\main\resources\phantomjs.exe Jul 27,
2016 9:20:01 PM org.openqa.selenium.phantomjs.PhantomJSDriverService
 INFO: port: 48904 Jul 27, 2016 9:20:01 PM
org.openqa.selenium.phantomjs.PhantomJSDriverService  INFO:
arguments: [--webdriver=48904, --webdriver-logfile=C:\Users\Ajatshatru
Singh\workspace\Assignment\phantomjsdriver.log] Jul 27, 2016 9:20:01
PM org.openqa.selenium.phantomjs.PhantomJSDriverService  INFO:
environment: {} Exception in thread "main"
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.39.0',
revision: '14fa800511cc5d66d426e08b0b2ab926c7ed7398', time:
'2013-12-16 13:18:38' System info: host: 'Ajatshatru', ip:
'10.31.32.236', os.name: 'Windows 8', os.arch: 'amd64', os.version:
'6.2', java.version: '1.7.0_51' Driver info: driver.version:
PhantomJSDriver   at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
  at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
  at
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:111)
  at
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:115)
  at
org.openqa.selenium.phantomjs.PhantomJSDriver.(PhantomJSDriver.java:110)
  at
org.openqa.selenium.phantomjs.PhantomJSDriver.(PhantomJSDriver.java:99)
  at Partik.Assignment.WebDriverQueue.main(WebDriverQueue.java:37)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting
for driver server to start. Build info: version: '2.39.0', revision:
'14fa800511cc5d66d426e08b0b2ab926c7ed7398', time: '2013-12-16
13:18:38' System info: host: 'Ajatshatru', ip: '10.31.32.236',
os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2',
java.version: '1.7.0_51' 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:527)
  ... 6 more Caused by:
org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting
for [http://localhost:48904/status] to be available after 20004 ms    at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
  at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
  ... 8 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)
  ... 9 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)
  ... 10 more 
Racil Hilan
  • 24,690
  • 13
  • 50
  • 55

1 Answers1

0

Well a simple restart did it for me. :|