Running the selenium-standalone npm package on an Ubuntu server - node.js

I am trying to run selenium-standalone on an Ubuntu server from Digital Ocean. I ssh into the server, then run these commands:
apt-get update
apt-get install nodejs nodejs-legacy npm default-jre
npm install selenium-standalone -g
selenium-standalone install
selenium-standalone start
That leads to a nice message that the selenium standalone server is running! But when I try to connect to it from a simple script on my computer:
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
.forBrowser('chrome')
.usingServer('http://XXX.XXX.XXX.XX:4444/wd/hub')
.build();
I get two huge error messages. On the server, I get:
23:49:09.596 INFO - Executing: [new session: Capabilities [{browserName=chrome}]])
23:49:09.599 INFO - Creating a new session for Capabilities [{browserName=chrome}]
Starting ChromeDriver 2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e) on port 13700
Only local connections are allowed.
23:49:09.644 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'ubuntu-nodesele', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:204)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:166)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
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.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'ubuntu-nodesele', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)
... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-47-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 23 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'ubuntu-nodesele', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
... 14 more
23:49:09.653 WARN - Exception: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-47-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 23 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'ubuntu-nodesele', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
And on my computer, trying to connect to the server, I get:
WebDriverError: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-47-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 23 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'ubuntu-nodesele', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at WebDriverError (/Users/liamgray/webdriverio-test/node_modules/selenium-webdriver/lib/error.js:27:5)
at Object.checkLegacyResponse (/Users/liamgray/webdriverio-test/node_modules/selenium-webdriver/lib/error.js:505:15)
at parseHttpResponse (/Users/liamgray/webdriverio-test/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/Users/liamgray/webdriverio-test/node_modules/selenium-webdriver/lib/http.js:440:13)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (/Users/liamgray/webdriverio-test/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
at Function.createSession (/Users/liamgray/webdriverio-test/node_modules/selenium-webdriver/chrome.js:709:29)
at createDriver (/Users/liamgray/webdriverio-test/node_modules/selenium-webdriver/index.js:167:33)
at Builder.build (/Users/liamgray/webdriverio-test/node_modules/selenium-webdriver/index.js:623:16)
at new Bot (/Users/liamgray/webdriverio-test/test.js:17:8)
at Object.<anonymous> (/Users/liamgray/webdriverio-test/test.js:122:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
It seems like the errors are saying that Chrome wasn't installed on the server correctly. But I thought that was supposed to happen during the selenium-standalone install command?
Any pointers in the right direction are welcome!

The selenium-standalone package installs selenium & it's browser drivers not the browser itself.
Selenium need its browser driver to interact with a specific browser. In your case it needs the chrome driver and it's installed on the server. But you don't have the browser.
You can install chrome by refering to this page. I recommend installing google-chrome-stable

Related

E/launcher - session not created: This version of Chrome Driver only supports Chrome version 93 while running protractor tests

I try to run the protractor tests but I encountered an error:
[14:14:42] I/launcher - Running 1 instances of WebDriver
[14:14:42] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[14:14:44] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 93
Current browser version is 92.0.4515.107 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
(Driver info: chromedriver=93.0.4577.15 (660fc11082ba57405eca2e8c49c3e1af756fbfae-refs/branch-heads/4577#{#203}),platform=Windows NT 10.0.19042 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 895 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'DESKTOP-KTUDS3A', ip: '192.168.0.25', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_291'
Driver info: driver.version: unknown
[14:14:44] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 93
Current browser version is 92.0.4515.107 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
(Driver info: chromedriver=93.0.4577.15 (660fc11082ba57405eca2e8c49c3e1af756fbfae-refs/branch-heads/4577#{#203}),platform=Windows NT 10.0.19042 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 895 milliseconds
Tried to change the driver version to 92 using webdriver-manager update --versions.chrome 92.0.4515.107 from here but with no luck, the error still exists.
Any idea how to fix this?
your chrome is 92, chromedriver is 93. You need to match them.
First try upgrading your chrome. If by the time you try chrome v93 is not out, you need to downgrade your chromdriver version. For more info go here

E/launcher - SessionNotCreatedError: Expected browser binary location, but unable to find binary in default location in Jenkins(linux)

I am new to Jenkins
I am trying to run Angular protractor test cases in Jenkins linux environment. Those are running fine in the Windows machine.
I am running selenium server using webdriver-manager running on http://127.0.0.1:4444/wd/hub
I have also installed xvfb plugin in Jenkins, still the issue remains the same.
Protractor.config.js
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
args: ['--disable-browser-side-navigation']
}
},
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
directConnect: false,
I am getting following error in Jenkins
[04:31:55] I/launcher - Running 1 instances of WebDriver
[04:31:55] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[04:32:15] E/launcher - Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '1031ca678034', ip: '172.17.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.93-boot2docker', java.version: '1.8.0_242'
Driver info: driver.version: unknown
[04:32:15] E/launcher - WebDriverError: Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '1031ca678034', ip: '172.17.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.93-boot2docker', java.version: '1.8.0_242'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/var/jenkins_home/workspace/angular-protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/var/jenkins_home/workspace/angular-protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/var/jenkins_home/workspace/angular-protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
at Function.createSession (/var/jenkins_home/workspace/angular-protractor/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
at Function.createSession (/var/jenkins_home/workspace/angular-protractor/node_modules/selenium-webdriver/chrome.js:761:15)
at createDriver (/var/jenkins_home/workspace/angular-protractor/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/var/jenkins_home/workspace/angular-protractor/node_modules/selenium-webdriver/index.js:626:16)
at Hosted.getNewDriver (/var/jenkins_home/workspace/angular-protractor/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
at Runner.createBrowser (/var/jenkins_home/workspace/angular-protractor/node_modules/protractor/built/runner.js:195:43)
at q.then.then (/var/jenkins_home/workspace/angular-protractor/node_modules/protractor/built/runner.js:339:29)
at _fulfilled (/var/jenkins_home/workspace/angular-protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/var/jenkins_home/workspace/angular-protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/var/jenkins_home/workspace/angular-protractor/node_modules/q/q.js:796:13)
[04:32:15] E/launcher - Process exited with error code 199
npm ERR! code ELIFECYCLE
npm ERR! errno 199
npm ERR! angular-protractor#0.0.0 e2e: protractor ./e2e/protractor.conf.js
npm ERR! Exit status 199

How do I use Xvfb to run protractor headless on Jenkins with chrome?

I am trying to run my protractor program from Jenkins, but since Jenkins doesn't have a display, I need to run chrome in headless mode. Since chrome doesn't have headless mode, I need to emulate a display using xvfb.
I followed a bunch of tutorials but when I run protractor, chrome crashes.
Here's what I have:
Build - Execute Shell (In Jenkins job)
#emulate display
echo "Starting xvfb on :99..."
Xvfb -ac :99 -screen 0 1280x1024x16 &
export DISPLAY=:99
echo "Checking that xvfb started ok..."
xdpyinfo -display :99 >/dev/null 2>&1 && echo "xvfb is using :99" || echo "xvfb is not using :99, it's free."
#now start my program
xvfb-run -a --server-args='-screen 0, 1024x768x16' protractor conf.js
And here's my output:
+ echo Starting xvfb on :99...
Starting xvfb on :99...
+ export DISPLAY=:99
+ echo Checking that xvfb started ok...
Checking that xvfb started ok...
+ xdpyinfo -display :99
+ Xvfb -ac :99 -screen 0 1280x1024x16
+ echo xvfb is using :99
xvfb is using :99
[22:26:25] I/local - Starting selenium standalone server...
[22:26:25] I/launcher - Running 1 instances of WebDriver
[22:26:26] I/local - Selenium standalone server started at http://10.0.0.82:54385/wd/hub
[22:27:26] E/launcher - unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3),platform=Linux 4.4.0-47-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.16 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'ip-10-0-0-82', ip: '10.0.0.82', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
[22:27:26] E/launcher - WebDriverError: unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3),platform=Linux 4.4.0-47-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.16 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'ip-10-0-0-82', ip: '10.0.0.82', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at WebDriverError (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/lib/error.js:27:5)
at Object.checkLegacyResponse (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/lib/error.js:639:15)
at parseHttpResponse (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/http/index.js:538:13)
at client_.send.then.response (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/http/index.js:472:11)
at ManagedPromise.invokeCallback_ (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at asyncRun (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/lib/promise.js:2820:25)
at /jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Builder.build (/jenkins/workspace/myjob/src/js/node_modules/selenium-webdriver/builder.js:458:24)
at Local.DriverProvider.getNewDriver (/jenkins/workspace/myjob/src/js/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
at Runner.createBrowser (/jenkins/workspace/myjob/src/js/node_modules/protractor/built/runner.js:198:43)
at /jenkins/workspace/myjob/src/js/node_modules/protractor/built/runner.js:277:30
at _fulfilled (/jenkins/workspace/myjob/src/js/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/jenkins/workspace/myjob/src/js/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/jenkins/workspace/myjob/src/js/node_modules/q/q.js:796:13)
at /jenkins/workspace/myjob/src/js/node_modules/q/q.js:604:44
at runSingle (/jenkins/workspace/myjob/src/js/node_modules/q/q.js:137:13)
[22:27:26] E/launcher - Process exited with error code 199
I keep getting Chrome failed to start: crashed with everything I tried... is this a problem with how I'm starting or configuring xvfb? Or is this a problem with my protractor code? The stacktrace isn't helping me at all x.x
I would recommend using the Jenkins Xvfb Plugin. It works really well without having to mess too much with configurations.
To set up a job, just click on the xvfb option to run at the start of the job and shut down xvfb at the end of your job. Once you've set that, you can execute your Protractor commands without the xvfb stuff: protractor conf.js.

Protractor doesn't work on MacOS Sierra

I've updated the node, npm, webdriver-manager, chromedriver and protractor but the browser crashed when the protractor trying to load it.
Also I've already tried to do part of the solutions from gitHub but nothing was help in this use case.
The errors are below -
Node console:
Idans-MacBook-Pro:tests idan$ ./node_modules/protractor/bin/protractor conf.js
[15:12:39] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[15:12:39] I/launcher - Running 1 instances of WebDriver
[15:13:51] E/launcher - session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"546.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.22.397929 (fb72fb249a903a0b1041ea71eb4c8b3fa0d9be5a),platform=Mac OS X 10.12.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.12 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Idans-MacBook-Pro.local', ip: '192.168.1.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
[15:13:51] E/launcher - SessionNotCreatedError: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"546.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.22.397929 (fb72fb249a903a0b1041ea71eb4c8b3fa0d9be5a),platform=Mac OS X 10.12.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.12 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Idans-MacBook-Pro.local', ip: '192.168.1.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at WebDriverError (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:10)
at SessionNotCreatedError (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:308:10)
at Object.checkLegacyResponse (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)
at parseHttpResponse (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13)
at /Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11
at ManagedPromise.invokeCallback_ (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at /Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25
at /Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
From: Task: WebDriver.createSession()
at Function.createSession (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Builder.build (/Users/idan/automation/tests/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
at Hosted.DriverProvider.getNewDriver (/Users/idan/automation/tests/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
at Runner.createBrowser (/Users/idan/automation/tests/node_modules/protractor/built/runner.js:198:43)
at /Users/idan/automation/tests/node_modules/protractor/built/runner.js:285:30
at _fulfilled (/Users/idan/automation/tests/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/idan/automation/tests/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/idan/automation/tests/node_modules/protractor/node_modules/q/q.js:796:13)
at /Users/idan/automation/tests/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/Users/idan/automation/tests/node_modules/protractor/node_modules/q/q.js:137:13)
[15:13:51] E/launcher - Process exited with error code 199
Idans-MacBook-Pro:tests idan$
Webdriver manager console:
15:12:39.496 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome, chromeOptions={args=[--no-sandbox, --test-type, --memory-metrics, --console, --crash-on-failure], prefs={download={directory_upgrade=true, default_directory=./Users/idan/automation/tests/downloaded/, prompt_for_download=false}}}}]])
15:12:39.513 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome, chromeOptions={args=[--no-sandbox, --test-type, --memory-metrics, --console, --crash-on-failure], prefs={download={directory_upgrade=true, default_directory=./Users/idan/automation/tests/downloaded/, prompt_for_download=false}}}}]
Starting ChromeDriver 2.22.397929 (fb72fb249a903a0b1041ea71eb4c8b3fa0d9be5a) on port 38520
Only local connections are allowed.
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
15:12:51.195 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Idans-MacBook-Pro.local', ip: '192.168.1.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12', java.version: '1.8.0_111'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:204)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:166)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
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.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Idans-MacBook-Pro.local', ip: '192.168.1.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12', java.version: '1.8.0_111'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)
... 9 more
Caused by: org.openqa.selenium.SessionNotCreatedException: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"546.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.22.397929 (fb72fb249a903a0b1041ea71eb4c8b3fa0d9be5a),platform=Mac OS X 10.12.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.12 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Idans-MacBook-Pro.local', ip: '192.168.1.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
... 14 more
15:13:21.516 WARN - Exception: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"546.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.22.397929 (fb72fb249a903a0b1041ea71eb4c8b3fa0d9be5a),platform=Mac OS X 10.12.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.12 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Idans-MacBook-Pro.local', ip: '192.168.1.23', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Update chromedriver to the latest version (I believe it is in v2.25).
According to the error, you're using chromedriver 2.22 with google Chrome v54 and they're incompatible.
After updating the chromedriver in manually you should do the steps below as well -
Change "chromedriver": "2.22", to "chromedriver": "2.24", in node_modules/webdriver-manager/built/config.json
Change mac32 to mac64 in node_modules/webdriver-manager/built/lib/binaries/chrome_driver.js
Now it works like a charm.

Blank Firefox Window Issue in Selenium PHPUnit Test in Linux Mint

I was trying to test out a page of mine using Selenium and phpunit. I had coded it properly and tried it out on a Ubuntu 14.04 machine. It tested out properly.
However I do not remember the version of selenium server and firefox used.
Now after some issues, I had removed Ubuntu and intalled Mint on my system.
While testing the page, I get a lot of error messages and a blank firefox screen.
Current version of firefox is 30 and Selenium 2.4.2
Tried with firefox versions 25,26,27,30.
I have posted the codes below.
Any help will be appreciated.
Output of Selenium starting
java -jar selenium-server-standalone-2.42.2.jar25 Jun, 2014 3:36:17 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
15:36:17.264 INFO - Java: Sun Microsystems Inc. 20.45-b01
15:36:17.264 INFO - OS: Linux 3.13.0-24-generic amd64
15:36:17.280 INFO - v2.42.2, with Core v2.42.2. Built from revision 6a6995d
15:36:17.347 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX
15:36:17.398 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
15:36:17.399 INFO - Version Jetty/5.1.x
15:36:17.400 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
15:36:17.401 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:36:17.401 INFO - Started HttpContext[/,/]
15:36:17.419 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#a39ab89
15:36:17.419 INFO - Started HttpContext[/wd,/wd]
15:36:17.422 INFO - Started SocketListener on 0.0.0.0:4444
15:36:17.422 INFO - Started org.openqa.jetty.jetty.Server#5abb7465
Output of Running a PHPUnit Test
phpunit testBooking.php
PHPUnit 3.7.28 by Sebastian Bergmann.
E
Time: 5.24 seconds, Memory: 3.00Mb
There was 1 error:
1) TestBookingBlockDate::testBlock
RuntimeException: POST /session/url
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'Sworoop', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-24-generic', java.version: '1.6.0_45'
Driver info: driver.version: unknown
/var/www/Folder/UnitTests/TurningStone/testBooking.php:13
/var/www/Folder/UnitTests/TurningStone/testBooking.php:13
FAILURES!
Tests: 1, Assertions: 1, Errors: 1.
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'DELETE /session
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'Sworoop', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-24-generic', java.version: '1.6.0_45'
Driver info: driver.version: unknown' in /usr/share/php/PHPUnit/Extensions/Selenium2TestCase/Driver.php:127
Stack trace:
#0 /usr/share/php/PHPUnit/Extensions/Selenium2TestCase/Session.php(137): PHPUnit_Extensions_Selenium2TestCase_Driver->curl('DELETE', Object(PHPUnit_Extensions_Selenium2TestCase_URL))
#1 /usr/share/php/PHPUnit/Extensions/Selenium2TestCase/Session.php(117): PHPUnit_Extensions_Selenium2TestCase_Session->stop()
#2 [internal function]: PHPUnit_Extensions_Selenium2TestCase_Session->__destruct()
#3 {main}
thrown in /usr/share/php/PHPUnit/Extensions/Selenium2TestCase/Driver.php on line 127
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:129
During this I get a blank firefox window which I have to manually close.
Solved it after reinstalling PHPUnit using composer instead of apt.
Thanks everyone :)

Resources