Trouble running Protractor tests using Selenium Server - node.js

Trying to run Protractor/Jasmine/Selenium e2e tests
Trying to run e2e tests using Protractor using the stand alone Selenium server and the chrome driver.
I get the following Selenium server error when I try to run my test using Protractor:
14:08:24.188 WARN - Exception: C:\Users\ARM678\AppData\Local\Temp\jna--1409357381\jna1939368593138214681.dll: %1 is not a valid Win32 application
Here are some details...
I start Selenium stand alone server by executing at the command line as follows (passing in the chrome web driver location):
Command
java -jar selenium-server-standalone-2.52.0.jar -Dwebdriver.chrome.driver="C:\TDAWare\servers\selenium\drivers\chromedriver.exe"
Output (Looks Good So Far):
14:00:27.695 INFO - Launching a standalone Selenium Server
Setting system property webdriver.chrome.driver to C:\TDAWare\servers\selenium\drivers\chromedriver.exe
14:00:27.845 INFO - Java: Oracle Corporation 25.72-b15
14:00:27.846 INFO - OS: Windows 7 6.1 x86
14:00:27.855 INFO - v2.52.0, with Core v2.52.0. Built from revision 4c2593c
14:00:27.918 INFO - Driver class not found: com.opera.core.systems.OperaDriver
14:00:27.918 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
14:00:27.925 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform VISTA
14:00:28.100 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
14:00:28.100 INFO - Selenium Server is up and running
Protractor conf.js file:
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['tdau-homepage-spec.js'],
allScriptsTimeout: 200000,
jasmineNodeOpts: {
defaultTimeoutInterval: 200000,
showColors: true,
print: function() {}
},
onPrepare: function() {
var SpecReporter = require('jasmine-spec-reporter');
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
}
}
Protractor tdau-homepage-spec.js
'use strict';
describe('My first test suite', function() {
it('should bring up a web page', function() {
browser.get('https://internal.tdameritradeu.com/dist');
expect(browser.getTitle()).toEqual('TD Ameritrade U');
});
});
Run Test (Everything breaks):
protractor conf.js
I get the following 2 stack traces. The first is from the Selenium Server. The second is from protractor.
From Selenium Server:
14:08:22.142 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome, platform=WINDOWS}]])
14:08:22.154 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome, platform=WINDOWS}]
Starting ChromeDriver 2.16.333243 (0bfa1d3575fc1044244f21ddb82bf870944ef961) on port 38568
Only local connections are allowed.
14:08:24.161 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'ILOL-F8VN662', ip: '10.20.102.66', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_72'
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: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:202)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:164)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:130)
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.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'ILOL-F8VN662', ip: '10.20.102.66', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_72'
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(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
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:103)
... 9 more
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\ARM678\AppData\Local\Temp\jna--1409357381\jna1939368593138214681.dll: %1 is not a valid Win32 application
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:761)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:736)
at com.sun.jna.Native.<clinit>(Native.java:131)
at org.openqa.selenium.os.Kernel32.<clinit>(Kernel32.java:34)
at org.openqa.selenium.os.ProcessUtils.killWinProcess(ProcessUtils.java:133)
at org.openqa.selenium.os.ProcessUtils.killProcess(ProcessUtils.java:81)
at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.destroyHarder(UnixProcess.java:247)
at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$2(UnixProcess.java:246)
at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:125)
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:155)
at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:196)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:94)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:526)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:134)
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
14:08:24.188 WARN - Exception: C:\Users\ARM678\AppData\Local\Temp\jna--1409357381\jna1939368593138214681.dll: %1 is not a valid Win32 application
From Protractor I get the following Stack Trace:
λ protractor conf.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
C:\TDAWare\servers\node\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
var template = new Error(this.message);
^
UnknownError: C:\Users\ARM678\AppData\Local\Temp\jna--1409357381\jna1939368593138214681.dll: %1 is not a valid Win32 application
at new bot.Error (C:\TDAWare\servers\node\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
at Object.bot.response.checkResponse (C:\TDAWare\servers\node\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
at C:\TDAWare\servers\node\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:160:24
at [object Object].promise.Promise.goog.defineClass.invokeCallback_ (C:/TDAWare/servers/node/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14)
at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ (C:/TDAWare/servers/node/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14)
at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (C:/TDAWare/servers/node/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
at goog.async.run.processWorkQueue (C:\TDAWare\servers\node\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15)
at process._tickCallback (node.js:368:9)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (C:\TDAWare\servers\node\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (C:\TDAWare\servers\node\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:131:30)
at [object Object].Builder.build (C:\TDAWare\servers\node\node_modules\protractor\node_modules\selenium-webdriver\builder.js:445:22)
at [object Object].DriverProvider.getNewDriver (C:\TDAWare\servers\node\node_modules\protractor\lib\driverProviders\driverProvider.js:42:27)
at [object Object].Runner.createBrowser (C:\TDAWare\servers\node\node_modules\protractor\lib\runner.js:190:37)
at C:\TDAWare\servers\node\node_modules\protractor\lib\runner.js:280:21
at _fulfilled (C:\TDAWare\servers\node\node_modules\protractor\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\TDAWare\servers\node\node_modules\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\TDAWare\servers\node\node_modules\protractor\node_modules\q\q.js:796:13)
at C:\TDAWare\servers\node\node_modules\protractor\node_modules\q\q.js:556:49
[launcher] Process exited with error code 1
My Thoughts...
I believe the root cause of the issue can be found in the Selenium stack trace when it says that
14:08:24.188 WARN - Exception: C:\Users\ARM678\AppData\Local\Temp\jna--1409357381\jna1939368593138214681.dll: %1 is not a valid Win32 application
I think that when it tries to utilize the chromedriver.exe, the chrome driver creates a dll file called jna1939368593138214681.dll and for some reason Windows doesn't like that file [a brilliant piece of deduction seeing that's exactly what the error says]
What I've tried:
I have tried re-downloading the driver to make sure the download
didn't corrupt the zip file
I have tried different versions of the driver.
I have tried unzipping the driver zip file with 2 different
zip utilities (winzip and winrar) to make sure the unzipping process
didn't corrupt anything
Environment
OS: Windows 7 Enterprise
Type: 64 bit
chromedriver version: 2.21 (also tried v.2.16)
node version: 4.2.4
npm version: 3.7.5
Note - Google explicitly states that chrome only has a 32-bit version of the driver and states that 64-bit systems will work with the 32-bit driver and that there is no 64-bit driver available.

Your configuration file is missing capabilities. You will need to tell protractor which driver to use: browserName: 'chrome'.
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
browserName: 'chrome'
},
specs: ['tdau-homepage-spec.js'],
allScriptsTimeout: 200000,
jasmineNodeOpts: {
defaultTimeoutInterval: 200000,
showColors: true,
print: function() {}
},
onPrepare: function() {
var SpecReporter = require('jasmine-spec-reporter');
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
}
}

Related

Selenium in "HeadLess" mode "Runtime.executionContextCreated has invalid 'context'" on Vagrant [duplicate]

I'm trying to get started using selenium and have downloaded a chrome driver and put into my classpath. I'm just trying to get the title right now to see if I can get it to work. Code currently looks like this:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Flows {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "/Users/mn/Desktop/project/turv/src/main/chromedriver");
WebDriver driver = new ChromeDriver();
String baseUrl = "http://google.dk/";
driver.get(baseUrl);
System.out.println(driver.getTitle());
driver.close();
}
}
I expected my output to be something along the lines of "Google", but I get this error instead:
Connected to the target VM, address: '127.0.0.1:55299', transport: 'socket'
Starting ChromeDriver (v2.8.241036) on port 2571
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
May 07, 2018 12:12:35 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Disconnected from the target VM, address: '127.0.0.1:55299', transport: 'socket'
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"11895A1B77AC560388AA2919259E1422","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=66.0.3359.139)
(Driver info: chromedriver=2.8.241036,platform=Mac OS X 10.13.3 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'cetreas-MBP', ip: 'fe80:0:0:0:c9e:2c67:1d27:4e0b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.3', java.version: '1.8.0_161'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {userDataDir: /var/folders/s7/lv2wt4t15cn...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: true, nativeEvents: true, platform: MAC, platformName: MAC, rotatable: false, takesHeapSnapshot: true, takesScreenshot: true, version: 66.0.3359.139, webStorageEnabled: true}
Session ID: ca1f4ba131e73c3d01058bec2b976d22
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:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:273)
at com.cetrea.flows.Flows.main(Flows.java:15)
I cant really figure out what the error is trying to tell me. Is it because I'm asking for the title before it has fully loaded the site maybe? Do I need to add some kind of waitforit command before the getTitle() ?
This error message...
org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"11895A1B77AC560388AA2919259E1422","isDefault":true},"id":1,"name":"","origin":"://"}
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.8 which is pretty ancient.
You are using chrome=66.0
Release Notes of ChromeDriver v2.38 clearly mentions the following :
Supports Chrome v65-67
So there is a clear mismatch between ChromeDriver version (v2.8) and the Chrome Browser version (v66.0)
Solution
Upgrade ChromeDriver to current ChromeDriver v2.38 level.
Keep Chrome version at Chrome v66.x levels. (as per ChromeDriver v2.38 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Local functional tests start after more then 1 minute

I have the same tests, the same selenium-server-standalone (2.43.1) and chromedriver (2.10).
I have only functional tests (no unit tests).
My Chrome is at version 37. My OSX is at version 10.9.5. Java version is 1.7.0_51 (Java 7 update 67).
When I run tests a new Chrome instance is opened with an empty tab:
With intern 1.7.0 tests start in less then 10 seconds.
With intern 2.1.1 tests start in 55-60 seconds.
Selenium logs look like this (when run by intern 2.1.1):
01:26:50.195 INFO - Launching a standalone server
01:26:50.388 INFO - Java: Oracle Corporation 24.51-b03
01:26:50.388 INFO - OS: Mac OS X 10.9.5 x86_64
01:26:50.487 INFO - v2.43.1, with Core v2.43.1. Built from revision 5163bce
01:26:50.734 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: MAC
01:26:50.846 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
01:26:50.847 INFO - Version Jetty/5.1.x
01:26:50.850 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
01:26:50.851 INFO - Started HttpContext[/selenium-server,/selenium-server]
01:26:50.851 INFO - Started HttpContext[/,/]
01:26:56.063 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#1f8f110d
01:26:56.064 INFO - Started HttpContext[/wd,/wd]
01:26:56.101 INFO - Started SocketListener on 0.0.0.0:4444
01:26:56.101 INFO - Started org.openqa.jetty.jetty.Server#71a9b093
01:27:24.536 INFO - Executing: [new session: Capabilities [{idle-timeout=60, browserName=chrome, name=tests/intern_local, selenium-version=2.43.1, chromeOptions={args=[test-type]}}]])
01:27:24.592 INFO - Creating a new session for Capabilities [{idle-timeout=60, browserName=chrome, name=tests/intern_local, selenium-version=2.43.1, chromeOptions={args=[test-type]}}]
Starting ChromeDriver (v2.10.267517) on port 32601
Only local connections are allowed.
01:27:26.447 INFO - Done: [new session: Capabilities [{idle-timeout=60, browserName=chrome, name=tests/intern_local, selenium-version=2.43.1, chromeOptions={args=[test-type]}}]]
01:27:26.465 INFO - Executing: [get: about:blank])
01:27:26.865 INFO - Done: [get: about:blank]
01:27:26.875 INFO - Executing: [get location context])
01:27:26.876 INFO - Executing: [take screenshot])
01:27:26.876 INFO - Executing: [get local storage size])
01:27:26.876 INFO - Executing: [doubleclick: no args])
01:27:26.878 INFO - Executing: [execute async script: arguments[0](true);, []])
01:27:27.109 INFO - Done: [take screenshot]
01:27:27.114 INFO - Executing: [Long press: null])
01:27:27.154 INFO - Done: [doubleclick: no args]
01:27:27.158 INFO - Executing: [get window size])
01:27:27.169 INFO - Done: [execute async script: arguments[0](true);, []]
01:27:27.169 WARN - Exception thrown
java.lang.UnsupportedOperationException: Underlying driver does not implement advanced user interactions yet.
at org.openqa.selenium.support.events.EventFiringWebDriver.getTouch(EventFiringWebDriver.java:311)
at org.openqa.selenium.remote.server.handler.interactions.touch.LongPressOnElement.call(LongPressOnElement.java:40)
at org.openqa.selenium.remote.server.handler.interactions.touch.LongPressOnElement.call(LongPressOnElement.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
01:27:27.189 WARN - Exception: Underlying driver does not implement advanced user interactions yet.
01:27:27.205 INFO - Done: [get window size]
01:27:27.212 INFO - Executing: [set window size])
01:27:27.323 INFO - Done: [set window size]
01:27:31.956 WARN - Exception thrown
org.openqa.selenium.WebDriverException: unknown error: Location must be set before it can be retrieved
(Session info: chrome=37.0.2062.124)
(Driver info: chromedriver=2.10.267517,platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3 milliseconds
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_51'
Session ID: 25d1fbe63300966edb133612003055d1
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/var/folders/zx/954mnbfn6s145t6d04g5nr5h0000gq/T/.org.chromium.Chromium.dGVeyG}, rotatable=false, locationContextEnabled=true, version=37.0.2062.124, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:614)
at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:32)
at org.openqa.selenium.remote.html5.RemoteLocationContext.location(RemoteLocationContext.java:38)
at org.openqa.selenium.chrome.ChromeDriver.location(ChromeDriver.java:195)
at org.openqa.selenium.remote.server.handler.html5.GetLocationContext.call(GetLocationContext.java:31)
at org.openqa.selenium.remote.server.handler.html5.GetLocationContext.call(GetLocationContext.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
01:27:37.029 WARN - Exception thrown
org.openqa.selenium.WebDriverException: unknown error: Runtime.evaluate threw exception: SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
(Session info: chrome=37.0.2062.124)
(Driver info: chromedriver=2.10.267517,platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8 milliseconds
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_51'
Session ID: 25d1fbe63300966edb133612003055d1
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/var/folders/zx/954mnbfn6s145t6d04g5nr5h0000gq/T/.org.chromium.Chromium.dGVeyG}, rotatable=false, locationContextEnabled=true, version=37.0.2062.124, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:614)
at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:32)
at org.openqa.selenium.remote.html5.RemoteLocalStorage.size(RemoteLocalStorage.java:72)
at org.openqa.selenium.remote.server.handler.html5.GetLocalStorageSize.call(GetLocalStorageSize.java:30)
at org.openqa.selenium.remote.server.handler.html5.GetLocalStorageSize.call(GetLocalStorageSize.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
01:27:47.173 WARN - Exception: unknown error: Location must be set before it can be retrieved
(Session info: chrome=37.0.2062.124)
(Driver info: chromedriver=2.10.267517,platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3 milliseconds
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_51'
Session ID: 25d1fbe63300966edb133612003055d1
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/var/folders/zx/954mnbfn6s145t6d04g5nr5h0000gq/T/.org.chromium.Chromium.dGVeyG}, rotatable=false, locationContextEnabled=true, version=37.0.2062.124, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
01:27:57.321 WARN - Exception: unknown error: Runtime.evaluate threw exception: SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
(Session info: chrome=37.0.2062.124)
(Driver info: chromedriver=2.10.267517,platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8 milliseconds
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_51'
Session ID: 25d1fbe63300966edb133612003055d1
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/var/folders/zx/954mnbfn6s145t6d04g5nr5h0000gq/T/.org.chromium.Chromium.dGVeyG}, rotatable=false, locationContextEnabled=true, version=37.0.2062.124, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
01:28:27.773 INFO - Executing: [get: data:text/html;charset=utf-8,%3C!DOCTYPE%20html%3E%3Ctitle%3Ea%3C%2Ftitle%3E])
01:28:27.794 INFO - Done: [get: data:text/html;charset=utf-8,%3C!DOCTYPE%20html%3E%3Ctitle%3Ea%3C%2Ftitle%3E]
01:28:27.799 INFO - Executing: [get title])
01:28:27.803 INFO - Done: [get title]
...
My intern configuration looks like:
define({
proxyPort: 9000,
proxyUrl: 'http://localhost:9000/',
capabilities: {
'selenium-version': '2.43.1'
},
environments: [
{ browserName: 'chrome'}
],
maxConcurrency: 3,
tunnel: 'NullTunnel',
loader: {},
suites: [],
functionalSuites: 'tests/all_functional',
reporters: ['console'],
excludeInstrumentation: /^tests\//
});
I tried to use Selenium 2.42.2 with chromedriver 2.10 and chromedriver 2.9 but the results are similar.
Update 1
The same problem persist with OSX 10.10, Java 1.7.0_51 (Java 7 update 71), chromedriver 2.11 and Chrome 38.0.2125.104.
Update 2
I started looking at why there is such a big delay between HttpContext and ServletHandler startup. Debug shows that New random session seed takes that long time (5 sec). It seems that all errors that take longer time have time that is multiple of 5 (5 sec, 10 sec and 25 sec).
On other Unix systems this problem was solved by replacing /dev/random by /dev/urandom but on OSX there should be no difference between them. I tried feeding /dev/random with data while selenium was running but it didn't help.
Running with sudo gives the same result.
Specifying -Djava.security.egd=file:///dev/urandom gives the same result.
Update 3
On a new machine problem disappeared. And as I have no more the old machine - the answer will remain a mystery.
The only thing that I think could be different between these machines is JDK.
I ran into this issue on macOS Sierra when using selenium-standalone-server 2.42.2 and chromedriver 2.25. I tried several version combinations of the two while using java version 1.8.0_91 to no avail.
The issue was resolved by reverting to a previous version of java, java version 1.8.0_45. Not the best solution, so I'm using http://www.jenv.be/ to go back and forth when I need to. This does not identify the issue's root cause but I hope this workaround helps someone, took me a while to find it.

WebDriverJS with PhantomJS works on OSX, but not on Linux

I'm using a combination of:
Selenium Standalone - https://github.com/vvo/selenium-standalone
WebDriverJS - https://github.com/webdriverio/webdriverio
Medium's PhantomJS NPM wrapper - https://github.com/Medium/phantomjs
Each component works fine separately, and when I run:
var client = webdriverjs.remote({
desiredCapabilities: {
browserName: 'phantomjs',
'phantomjs.binary.path': '/path-to/node_modules/phantomjs/bin/phantomjs'
},
logLevel: 'silent'
});
client.init();
It works fine on OSX/Mac, but on our CI Linux server (Ubuntu), I get the following error message;
PhantomJS is launching GhostDriver...
Unable to open file '/path/to/phantomjsdriver.log'
Before the ineveitable Java stacktrace...
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:176)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:112)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:89)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:110)
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:173)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:200)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:162)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:128)
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
&
Driver info: driver.version: PhantomJSDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:590)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:127)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:110)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:99)
... 14 more
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
I suspect a permissions issue, but wondered if anyone has run into this problem before.
At the very least, it would be great to work out exactly why this is working on Mac.
This file - phantomjsdriver.log - Can only be created by a user with file write permissions.
Executing the program as 'root' fixed the issue.

Jasmine is timing out in protractor, Selenium Server crashes afterwards (issue is present in Chrome, Firefox - OK)

Really need some help on this one, I have been struggling for a really long time and cant figure it out on my own!
I am running tests in chrome and when protractor logs in to the system, it suddenly stops and , basically, crashes -
at first Jasmine is timing out (explicitly extended the timeout),enter code here
and then protractor cant quit the browser for long time (Log from
Selenium Server -Timed out receiving message from renderer: 295.458,
Timed out receiving message from renderer: 10.000)
So here is the code:
describe('Login with username and password', function () {
it('Logging in with VALID credentials', function () {
browser.get('');
expect(browser.getCurrentUrl()).toContain('login');
element(by.id('username')).sendKeys("username");
element(by.id('password')).sendKeys("password");
element(by.css('input[type="submit"]')).click();//here I am login into the system. On successful login, system loads lots of resources into the browser for subsequent bus logic
// browser.waitForAngular();
expect(browser.getCurrentUrl()).toContain('main');
var greeting = element(by.css("div.greeting"));
expect(greeting.getText()).toEqual('Hei, admin');
element(by.css('.logout')).click();
});
});
Log from protractor when it fails to quit browser and/or Selenium Server.
C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:109
var template = new Error(this.message);
^
ScriptTimeoutError: timeout: Timed out receiving message from renderer: 10.000
(Session info: chrome=37.0.2062.103)
(Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 310.28 seconds
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'LVALTP1065', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Session ID: 98ef9389e06f7736b7587ecd362729c0
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\ILJA~1.PAV\AppData\Local\Temp\scoped_dir3800_4224}, rotatable
=false, locationContextEnabled=true, version=37.0.2062.103, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false
, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
at new bot.Error (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:109:18)
at Object.bot.response.checkResponse (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9)
at C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:277:20
at C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1243:15
at webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1539:20
)
at notify (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:362:12)
at notifyAll (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:331:7)
at resolve (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:309:7)
at fulfill (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:429:5)
at C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1406:10
==== async task ====
WebDriver.executeScript()
at webdriver.WebDriver.schedule (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:268:15)
at webdriver.WebDriver.executeAsyncScript (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:496:15)
at Protractor.waitForAngular (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:913:22)
at to.(anonymous function) [as getCurrentUrl] (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:56:7)
at null.<anonymous> (C:\Users\ilja.pavlovs\Desktop\AngularApp\src\e2e\specs\test.js:28:28)
at C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd\index.js:94:14
at webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1539:20
)
at webdriver.promise.ControlFlow.runEventLoop_ (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1404:8)
at wrapper [as _onTimeout] (timers.js:261:14)
==== async task ====
WebDriver.quit()
at webdriver.WebDriver.schedule (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:268:15)
at webdriver.WebDriver.quit (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:333:21)
at HostedDriverProvider.teardownEnv (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\hosted.js:47:16)
at driverprovider_.setupEnv.then.then.then.then.passed (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:283:35)
at _fulfilled (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
at C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:573:44
at flush (C:\Users\ilja.pavlovs\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:108:17)
So basically it crashes at expect(browser.getCurrentUrl()).toContain('main'); - it was line 28 originally.
In Firefox all works perfectly! I have tried:
extending Jasmine timeout
using Chromedriver without selenium server
running wthout browser.waitForAngular() with browser.waitForAngular() uncommented
using Chromedriver without selenium server
List item
with all kind of different settings
with all kind of different settings protractor 1.2.0 and
1.1.1 versions
I would very appreciate any help with this one!

How do I get WebDriver working on a Mac from Haskell?

So (in my ongoing attempts to try and be a Haskell programmer) I thought I'd try using Haskell to automate control of Firefox on a mac. Went to https://github.com/kallisti-dev/hs-webdriver, installed webdriver, installed the standalone java selenium server and tried running the simple Hello World test (after fixing the syntax error, the 'config' argument to runSession should be (I assume) 'myConfig')
Looked like Firefox opened for a moment, then disappeared. The Java based selenium server produced tons of error messages. See below.
Anyone know what's wrong?
For what it's worth, after trying this, I installed the python bindings and had a python version working in about 10 seconds flat!
dhjmacpro:~/bin $ java -jar selenium-server-standalone-2.42.2.jar
Jul 25, 2014 12:32:28 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
12:32:28.052 INFO - Java: Apple Inc. 20.65-b04-462
12:32:28.053 INFO - OS: Mac OS X 10.9.4 x86_64
12:32:28.061 INFO - v2.42.2, with Core v2.42.2. Built from revision 6a6995d
12:32:28.125 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: MAC
12:32:28.153 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
12:32:28.154 INFO - Version Jetty/5.1.x
12:32:28.154 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
12:32:28.155 INFO - Started HttpContext[/selenium-server,/selenium-server]
12:32:28.155 INFO - Started HttpContext[/,/]
12:32:28.185 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#3dbbd23f
12:32:28.185 INFO - Started HttpContext[/wd,/wd]
12:32:28.190 INFO - Started SocketListener on 0.0.0.0:4444
12:32:28.190 INFO - Started org.openqa.jetty.jetty.Server#4ca31e1b
12:32:55.022 INFO - Executing: [new session: Capabilities [{platform=ANY, javascriptEnabled=null, acceptSslCerts=null, firefox_binary=null, browserName=firefox, rotatable=null, locationContextEnabled=null, unexpectedAlertBehavior=null, version=null, loggingPrefs=org.openqa.selenium.logging.LoggingPreferences#45490eb5, firefox_profile=null, databaseEnabled=null, cssSelectorsEnabled=null, handlesAlerts=null, browserConnectionEnabled=null, proxy={proxyType=SYSTEM}, webStorageEnabled=null, nativeEvents=null, applicationCacheEnabled=null, takesScreenshot=null}]])
12:32:55.038 INFO - Creating a new session for Capabilities [{platform=ANY, javascriptEnabled=null, acceptSslCerts=null, firefox_binary=null, browserName=firefox, rotatable=null, locationContextEnabled=null, unexpectedAlertBehavior=null, version=null, loggingPrefs=org.openqa.selenium.logging.LoggingPreferences#45490eb5, firefox_profile=null, databaseEnabled=null, cssSelectorsEnabled=null, handlesAlerts=null, browserConnectionEnabled=null, proxy={proxyType=SYSTEM}, webStorageEnabled=null, nativeEvents=null, applicationCacheEnabled=null, takesScreenshot=null}]
12:32:57.851 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'dhjmacpro', ip: '192.168.0.45', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.6.0_65'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:176)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:112)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:89)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:110)
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:173)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:200)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:162)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:128)
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.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'dhjmacpro', ip: '192.168.0.45', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.6.0_65'
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:215)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:59)
... 10 more
Caused by: org.openqa.selenium.WebDriverException: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIPrefBranch.setCharPref]
Command duration or timeout: 181 milliseconds
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'dhjmacpro', ip: '192.168.0.45', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.6.0_65'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:104)
... 15 more
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIPrefBranch.setCharPref]
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'dhjmacpro', ip: '192.168.0.45', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.6.0_65'
Driver info: driver.version: unknown
12:32:57.857 WARN - Exception: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIPrefBranch.setCharPref]
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'dhjmacpro', ip: '192.168.0.45', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.6.0_65'
Driver info: driver.version: unknown
Okay so it seems that the library has not been updated in about a year but here are my suggestions:
Use homebrew to install selenium-standalone-server and chromedriver. Then use the config to select the standard Chrome configuration.
Beware that the 0.6.1 version of the library is lagging behind the current master that has important fixes to work with the latest selenium-server-standalone. You will find that it is mostly compatible but I ran into one issue: https://github.com/kallisti-dev/hs-webdriver/issues/60
From there you should be able to get the tests up and running. I know that I have it successfully running on my machine. If you have more questions about this approach just ask.

Resources