d48
d48

Reputation: 692

Error when trying to run unit tests with phantomjs and Selenium

I tried resolving my issue following the steps listed in the Wiki pages and using github.com/theintern/intern-examples/phantomjs-example in running phantomjs with Selenium server. Although I still get this error:

$ ./node_modules/.bin/intern-runner config=tests/intern
Listening on 0.0.0.0:9000
Starting tunnel...
UnknownError: [POST http://localhost:4444/wd/hub/session / 
{"desiredCapabilities":    
    {"browserName":"phantomjs","name":"tests/intern","idle-timeout":60}
}] 
org.openqa.selenium.browserlaunchers.Proxies
at Server._post  <node_modules\intern\node_modules\leadfoot\Server.js:68:9>
at Server.createSession  <node_modules\intern\node_modules\leadfoot\Server.js:282:15>
at Suite.setup  <node_modules\intern\runner.js:208:22>
at callOnSuite  <node_modules\intern\lib\Suite.js:131:42>
at call  <node_modules\intern\lib\Suite.js:182:13>
at Suite.run  <node_modules\intern\lib\Suite.js:269:4>
at <node_modules\intern\main.js:48:18>
at <node_modules\intern\lib\util.js:324:19>
at Array.forEach  <native>
at Object.run  <node_modules\intern\main.js:47:16>

TOTAL: tested 0 platforms, 0/0 tests failed; fatal error occurred

Anyone else getting this same issue and know how to resolve?

Instructions from Wiki:

  1. Using a local PhantomJS installation with Intern is very simple: In your Intern configuration, set environments: [ { browserName: 'phantomjs' } ] and tunnel: 'NullTunnel'
  2. Ensure that the directory containing the phantomjs executable is in your PATH (this will typically be the case if you installed with npm install -g phantomjs)
  3. Start your local Selenium server (java -jar selenium-server-standalone-2.xx.x.jar)
  4. Run intern-runner config=path/to/config

Any my exact files I'm using: https://github.com/theintern/intern-examples/tree/master/phantomjs-example

Selenium server error log

$ java -jar selenium-server-standalone-2.44.0.jar
13:05:37.261 INFO - Launching a standalone server
13:05:38.251 INFO - Java: Oracle Corporation 25.25-b02
13:05:38.251 INFO - OS: Windows 7 6.1 amd64
13:05:38.265 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
13:05:38.402 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
13:05:38.403 INFO - Version Jetty/5.1.x
13:05:38.405 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:05:39.348 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@6e3c1e69
13:05:39.349 INFO - Started HttpContext[/wd,/wd]
13:05:39.349 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
13:05:39.350 INFO - Started HttpContext[/,/]
13:05:39.355 INFO - Started SocketListener on 0.0.0.0:4444
13:05:39.356 INFO - Started org.openqa.jetty.jetty.Server@b1bc7ed
13:05:59.689 INFO - Executing: [new session: Capabilities [{name=tests/intern, browserName=phantomjs, idle-timeout=60}]])
13:05:59.707 INFO - Creating a new session for Capabilities [{name=tests/intern, browserName=phantomjs, idle-timeout=60}]
13:05:59.720 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'VM-C02JQ1VTDKQ4', ip: '127.0.0.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_25'
Driver info: driver.version: unknown
        at java.util.concurrent.FutureTask.report(Unknown Source)
        at java.util.concurrent.FutureTask.get(Unknown Source)
        at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:175)
        at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:111)
        at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:88)
        at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:108)
        at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:57)
        at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
        at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:112)
        at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:172)
        at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
        at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:163)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:129)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
        at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
        at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
        at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
        at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
        at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
        at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
        at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
        at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
        at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
        at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
        at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'VM-C02JQ1VTDKQ4', ip: '127.0.0.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_25'
Driver info: driver.version: unknown
        at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:69)
        at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:53)
        at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:54)
        at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:214)
        at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:59)
        ... 9 more
Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/browserlaunchers/Proxies
        at org.openqa.selenium.phantomjs.PhantomJSDriverService.createDefaultService(PhantomJSDriverService.java:178)
        at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:99)
        ... 14 more
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.browserlaunchers.Proxies
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 16 more
13:05:59.936 WARN - Exception: org.openqa.selenium.browserlaunchers.Proxies

Upvotes: 0

Views: 3954

Answers (2)

SelenUser
SelenUser

Reputation: 628

PhantomJS working well with Selenium 2.45

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.45.0</version>
</dependency>

Upvotes: 1

C Snover
C Snover

Reputation: 18766

PhantomJS is broken with Selenium 2.44.0 now too.

Best solution: Stop using PhantomJS!
Alternative solution: You’re stuck using Selenium 2.43 or earlier for as long as it takes for a PhantomJS patch.

Upvotes: 4

Related Questions