selenium: Selenium 3.1.0 phantomjs binary path not being picked up
Meta -
OS:
Linux 16.04
Selenium Version:
3.1.0
Browser:
PhantomJS
Expected behaviour
In previous versions of the Selenium standalone server it was possible to pass the path to the phantomjs binary as an argument to the JVM.
'/usr/bin/java' -Dphantomjs.binary.path='/home/john/.local/share/binman_phantomjs/linux64/2.1.1/phantomjs-2.1.1-linux-x86_64/bin/phantomjs' -jar '/home/john/.local/share/binman_seleniumserver/generic/3.0.1/selenium-server-standalone-3.0.1.jar' -port 4567
Attempting to open a new PhantomJS browser was successful with the following log output from the Selenium Server
> rd$server$log()[["stderr"]]
[1] "01:54:09.663 INFO - Selenium build info: version: '3.0.1', revision: '1969d75'"
[2] "01:54:09.664 INFO - Launching a standalone Selenium Server"
[3] "2017-02-19 01:54:09.678:INFO::main: Logging initialized @196ms"
[4] "01:54:09.721 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:"
[5] " registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX"
[6] "01:54:09.721 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:"
[7] " registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX"
[8] "01:54:09.721 INFO - Driver class not found: com.opera.core.systems.OperaDriver"
[9] "01:54:09.721 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:"
[10] "Unable to create new instances on this machine."
[11] "01:54:09.721 INFO - Driver class not found: com.opera.core.systems.OperaDriver"
[12] "01:54:09.721 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered"
[13] "01:54:09.722 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:"
[14] " registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX"
[15] "2017-02-19 01:54:09.752:INFO:osjs.Server:main: jetty-9.2.15.v20160210"
[16] "2017-02-19 01:54:09.771:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@2ef5e5e3{/,null,AVAILABLE}"
[17] "2017-02-19 01:54:09.782:INFO:osjs.ServerConnector:main: Started ServerConnector@724af044{HTTP/1.1}{0.0.0.0:4567}"
[18] "2017-02-19 01:54:09.782:INFO:osjs.Server:main: Started @300ms"
[19] "01:54:09.782 INFO - Selenium Server is up and running"
[20] "01:54:10.672 INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneTimeout 1800000 polling every 180000"
[21] "01:54:10.722 INFO - Executing: [new session: Capabilities [{nativeEvents=true, browserName=phantomjs, javascriptEnabled=true, version=, platform=ANY}]])"
[22] "01:54:10.736 INFO - Creating a new session for Capabilities [{nativeEvents=true, browserName=phantomjs, javascriptEnabled=true, version=, platform=ANY}]"
[23] "01:54:10.746 INFO - executable: /home/john/.local/share/binman_phantomjs/linux64/2.1.1/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
[24] "01:54:10.746 INFO - port: 7534"
[25] "01:54:10.746 INFO - arguments: [--webdriver=7534, --webdriver-logfile=/home/john/git/RSelenium/phantomjsdriver.log]"
[26] "01:54:10.746 INFO - environment: {}"
[27] "[INFO - 2017-02-19T09:54:11.111Z] GhostDriver - Main - running on port 7534"
[28] "01:54:11.187 INFO - Attempting bi-dialect session, assuming Postel's Law holds true on the remote end"
[29] "[INFO - 2017-02-19T09:54:11.223Z] Session [5cf9b540-f689-11e6-8293-5dae4fb16ca0] - page.settings - {\"XSSAuditingEnabled\":false,\"javascriptCanCloseWindows\":true,\"javascriptCanOpenWindows\":true,\"javascriptEnabled\":true,\"loadImages\":true,\"localToRemoteUrlAccessEnabled\":false,\"userAgent\":\"Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1\",\"webSecurityEnabled\":true}"
[30] "[INFO - 2017-02-19T09:54:11.223Z] Session [5cf9b540-f689-11e6-8293-5dae4fb16ca0] - page.customHeaders: - {}"
[31] "[INFO - 2017-02-19T09:54:11.224Z] Session [5cf9b540-f689-11e6-8293-5dae4fb16ca0] - Session.negotiatedCapabilities - {\"browserName\":\"phantomjs\",\"version\":\"2.1.1\",\"driverName\":\"ghostdriver\",\"driverVersion\":\"1.2.0\",\"platform\":\"linux-unknown-64bit\",\"javascriptEnabled\":true,\"takesScreenshot\":true,\"handlesAlerts\":false,\"databaseEnabled\":false,\"locationContextEnabled\":false,\"applicationCacheEnabled\":false,\"browserConnectionEnabled\":false,\"cssSelectorsEnabled\":true,\"webStorageEnabled\":false,\"rotatable\":false,\"acceptSslCerts\":false,\"nativeEvents\":true,\"proxy\":{\"proxyType\":\"direct\"}}"
[32] "[INFO - 2017-02-19T09:54:11.224Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 5cf9b540-f689-11e6-8293-5dae4fb16ca0"
[33] "01:54:11.234 INFO - Detected dialect: OSS"
[34] "01:54:11.246 INFO - Done: [new session: Capabilities [{nativeEvents=true, browserName=phantomjs, javascriptEnabled=true, version=, platform=ANY}]]"
Actual behaviour
On the most recent version (3.1.0) passing the path of the phantomjs binary
'/usr/bin/java' -Dphantomjs.binary.path='/home/john/.local/share/binman_phantomjs/linux64/2.1.1/phantomjs-2.1.1-linux-x86_64/bin/phantomjs' -jar '/home/john/.local/share/binman_seleniumserver/generic/3.1.0/selenium-server-standalone-3.1.0.jar' -port 4567
and attempting to open a PhantomJS browser results in the following error returned by the Selenium server ;
{"localizedMessage":["org.openqa.selenium.os.CommandLine.find(Ljava/lang/String;)Ljava/lang/String;"],"cause":{},"stackTrace":[{"fileName":["PhantomJSDriverService.java"],"nativeMethod":[false],"methodName":["findPhantomJS"],"className":["org.openqa.selenium.phantomjs.PhantomJSDriverService"],"hCode":[738768695],"lineNumber":[232],"class":["java.lang.StackTraceElement"]},{"fileName":["PhantomJSDriverService.java"],"nativeMethod":[false],"methodName":["createDefaultService"],"className":["org.openqa.selenium.phantomjs.PhantomJSDriverService"],"hCode":[-258433993],"lineNumber":[181],"class":["java.lang.StackTraceElement"]},{"fileName":["PhantomJSDriver.java"],"nativeMethod":[false],"methodName":["<init>"],"className":["org.openqa.selenium.phantomjs.PhantomJSDriver"],"hCode":[1583898601],"lineNumber":[105],"class":["java.lang.StackTraceElement"]},{"fileName":["NativeConstructorAccessorImpl.java"],"nativeMethod":[true],"methodName":["newInstance0"],"className":["sun.reflect.NativeConstructorAccessorImpl"],"hCode":[-917798116],"lineNumber":[-2],"class":["java.lang.StackTraceElement"]},{"fileName":["NativeConstructorAccessorImpl.java"],"nativeMethod":[false],"methodName":["newInstance"],"className":["sun.reflect.NativeConstructorAccessorImpl"],"hCode":[-1864225098],"lineNumber":[62],"class":["java.lang.StackTraceElement"]},{"fileName":["DelegatingConstructorAccessorImpl.java"],"nativeMethod":[false],"methodName":["newInstance"],"className":["sun.reflect.DelegatingConstructorAccessorImpl"],"hCode":[-2122307259],"lineNumber":[45],"class":["java.lang.StackTraceElement"]},{"fileName":["Constructor.java"],"nativeMethod":[false],"methodName":["newInstance"],"className":["java.lang.reflect.Constructor"],"hCode":[-1319859919],"lineNumber":[423],"class":["java.lang.StackTraceElement"]},{"fileName":["DefaultDriverProvider.java"],"nativeMethod":[false],"methodName":["callConstructor"],"className":["org.openqa.selenium.remote.server.DefaultDriverProvider"],"hCode":[-2096353668],"lineNumber":[103],"class":["java.lang.StackTraceElement"]},{"fileName":["DefaultDriverProvider.java"],"nativeMethod":[false],"methodName":["newInstance"],"className":["org.openqa.selenium.remote.server.DefaultDriverProvider"],"hCode":[1201680335],"lineNumber":[97],"class":["java.lang.StackTraceElement"]},{"fileName":["DefaultDriverFactory.java"],"nativeMethod":[false],"methodName":["newInstance"],"className":["org.openqa.selenium.remote.server.DefaultDriverFactory"],"hCode":[-1365021416],"lineNumber":[60],"class":["java.lang.StackTraceElement"]},{"fileName":["DefaultSession.java"],"nativeMethod":[false],"methodName":["call"],"className":["org.openqa.selenium.remote.server.DefaultSession$BrowserCreator"],"hCode":[2056168471],"lineNumber":[222],"class":["java.lang.StackTraceElement"]},{"fileName":["DefaultSession.java"],"nativeMethod":[false],"methodName":["call"],"className":["org.openqa.selenium.remote.server.DefaultSession$BrowserCreator"],"hCode":[2056168458],"lineNumber":[209],"class":["java.lang.StackTraceElement"]},{"fileName":["FutureTask.java"],"nativeMethod":[false],"methodName":["run"],"className":["java.util.concurrent.FutureTask"],"hCode":[-820313554],"lineNumber":[266],"class":["java.lang.StackTraceElement"]},{"fileName":["DefaultSession.java"],"nativeMethod":[false],"methodName":["run"],"className":["org.openqa.selenium.remote.server.DefaultSession$1"],"hCode":[-255143467],"lineNumber":[176],"class":["java.lang.StackTraceElement"]},{"fileName":["ThreadPoolExecutor.java"],"nativeMethod":[false],"methodName":["runWorker"],"className":["java.util.concurrent.ThreadPoolExecutor"],"hCode":[-1285150184],"lineNumber":[1142],"class":["java.lang.StackTraceElement"]},{"fileName":["ThreadPoolExecutor.java"],"nativeMethod":[false],"methodName":["run"],"className":["java.util.concurrent.ThreadPoolExecutor$Worker"],"hCode":[-242190645],"lineNumber":[617],"class":["java.lang.StackTraceElement"]},{"fileName":["Thread.java"],"nativeMethod":[false],"methodName":["run"],"className":["java.lang.Thread"],"hCode":[-82946320],"lineNumber":[745],"class":["java.lang.StackTraceElement"]}],"suppressed":[],"message":["org.openqa.selenium.os.CommandLine.find(Ljava/lang/String;)Ljava/lang/String;"],"hCode":[1031383493],"class":["java.lang.NoSuchMethodError"],"screen":{}}
with the selenium server error log showing:
> rd$server$log()[["stderr"]]
[1] "01:33:22.789 INFO - Selenium build info: version: '3.1.0', revision: '86a5d70'"
[2] "01:33:22.790 INFO - Launching a standalone Selenium Server"
[3] "2017-02-19 01:33:22.804:INFO::main: Logging initialized @203ms"
[4] "01:33:22.847 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:"
[5] " registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX"
[6] "01:33:22.848 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:"
[7] " registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX"
[8] "01:33:22.848 INFO - Driver class not found: com.opera.core.systems.OperaDriver"
[9] "01:33:22.848 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:"
[10] "Unable to create new instances on this machine."
[11] "01:33:22.848 INFO - Driver class not found: com.opera.core.systems.OperaDriver"
[12] "01:33:22.848 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered"
[13] "01:33:22.849 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:"
[14] " registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX"
[15] "2017-02-19 01:33:22.878:INFO:osjs.Server:main: jetty-9.2.15.v20160210"
[16] "2017-02-19 01:33:22.897:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@4520ebad{/,null,AVAILABLE}"
[17] "2017-02-19 01:33:22.909:INFO:osjs.ServerConnector:main: Started ServerConnector@475530b9{HTTP/1.1}{0.0.0.0:4567}"
[18] "2017-02-19 01:33:22.909:INFO:osjs.Server:main: Started @308ms"
[19] "01:33:22.909 INFO - Selenium Server is up and running"
[20] "01:33:23.814 INFO - SessionCleaner initialized with insideBrowserTimeout 0 and clientGoneTimeout 1800000 polling every 180000"
[21] "01:33:23.863 INFO - Executing: [new session: Capabilities [{nativeEvents=true, browserName=phantomjs, javascriptEnabled=true, version=, platform=ANY}]])"
[22] "01:33:23.880 INFO - Creating a new session for Capabilities [{nativeEvents=true, browserName=phantomjs, javascriptEnabled=true, version=, platform=ANY}]"
[23] "01:33:23.885 WARN - Exception thrown"
[24] "java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException"
[25] "Build info: version: '3.1.0', revision: '86a5d70', time: '2017-02-16 07:57:44 -0800'"
[26] "System info: host: 'ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-62-generic', java.version: '1.8.0_121'"
[27] "Driver info: driver.version: unknown"
[28] "\tat java.util.concurrent.FutureTask.report(FutureTask.java:122)"
[29] "\tat java.util.concurrent.FutureTask.get(FutureTask.java:192)"
[30] "\tat org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)"
[31] "\tat org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)"
[32] "\tat org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)"
[33] "\tat org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:131)"
[34] "\tat org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)"
[35] "\tat org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:36)"
[36] "\tat org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)"
[37] "\tat org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:189)"
[38] "\tat org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:222)"
[39] "\tat org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:184)"
[40] "\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:707)"
[41] "\tat org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:150)"
[42] "\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)"
[43] "\tat org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:808)"
[44] "\tat org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:587)"
[45] "\tat org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)"
[46] "\tat org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:515)"
[47] "\tat org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1061)"
[48] "\tat org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)"
[49] "\tat org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)"
[50] "\tat org.seleniumhq.jetty9.server.Server.handle(Server.java:499)"
[51] "\tat org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:310)"
[52] "\tat org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:257)"
[53] "\tat org.seleniumhq.jetty9.io.AbstractConnection$2.run(AbstractConnection.java:540)"
[54] "\tat org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)"
[55] "\tat org.seleniumhq.jetty9.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)"
[56] "\tat java.lang.Thread.run(Thread.java:745)"
[57] "Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException"
[58] "Build info: version: '3.1.0', revision: '86a5d70', time: '2017-02-16 07:57:44 -0800'"
[59] "System info: host: 'ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-62-generic', java.version: '1.8.0_121'"
[60] "Driver info: driver.version: unknown"
[61] "\tat org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)"
[62] "\tat org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)"
[63] "\tat org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)"
[64] "\tat org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)"
[65] "\tat org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:209)"
[66] "\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)"
[67] "\tat org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)"
[68] "\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)"
[69] "\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)"
[70] "\t... 1 more"
[71] "Caused by: java.lang.reflect.InvocationTargetException"
[72] "\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)"
[73] "\tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)"
[74] "\tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)"
[75] "\tat java.lang.reflect.Constructor.newInstance(Constructor.java:423)"
[76] "\tat org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)"
[77] "\t... 9 more"
[78] "Caused by: java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.find(Ljava/lang/String;)Ljava/lang/String;"
[79] "\tat org.openqa.selenium.phantomjs.PhantomJSDriverService.findPhantomJS(PhantomJSDriverService.java:232)"
[80] "\tat org.openqa.selenium.phantomjs.PhantomJSDriverService.createDefaultService(PhantomJSDriverService.java:181)"
[81] "\tat org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:105)"
[82] "\t... 14 more"
[83] "01:33:23.900 WARN - Exception: org.openqa.selenium.os.CommandLine.find(Ljava/lang/String;)Ljava/lang/String;"
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (5 by maintainers)
I have the same issue with latest selenium 3.6.0 and phantomjs 2.1.1. Is there’s any workaround or have to wait for next either selenium or phantomjs build?
Just note: works fine with next dependency:
Any news on this? Same trouble for 3.8.1 selenium and 2.1.1 PhantomJS.
@johndharrison this is fixed in server
3.2