How do I get WebDriver working on a Mac from Haskell? - 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.

Related

Selenium Error: "org.openqa.selenium.WebDriverException: Error loading page"

I keep running into this error when using a tool that attempts to load a locally-saved web page via Selenium, gekodriver, and firefox.
Versions utilized:
Selenium: 3.0.1
Gekodriver: 13.0
Firefox: 46.0
My constraints are that I have to use selenium 3.0.1, but the other dependencies can be altered. Has anybody run into this issue before?
1676503488636 geckodriver INFO Listening on 127.0.0.1:12651
Feb 15, 2023 3:24:48 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1676503488712 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.gQ6hEnrnMxIC
1676503488713 geckodriver::marionette INFO Starting browser /home/robert/firefox/firefox-bin
1676503488714 geckodriver::marionette INFO Connecting to Marionette on localhost:36313
1676503489262 Marionette INFO Listening on port 36313
Feb 15, 2023 3:24:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
org.openqa.selenium.WebDriverException: Error loading page
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'robert-XPS-8700', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-58-generic', java.version: '1.8.0_202'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, firefoxOptions={args=[], prefs={}}, appBuildId=20160421124000, version=, platform=LINUX, proxy={}, specificationLevel=1, acceptSslCerts=false, browserVersion=46.0, platformVersion=5.15.0-58-generic, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Linux, device=desktop}]
Session ID: 918b2a1b-0b33-4acf-ae5a-8545c55ad0d9
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.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
at shef.main.RLGExtractor.extract(RLGExtractor.java:105)
at shef.main.Tool.runFaultDetector(Tool.java:185)
at shef.main.Tool.<init>(Tool.java:136)
at shef.main.Tool.main(Tool.java:417)
As per the geckodriver specifications Selenium users must update to version 3.11 or later to use geckodriver like other clients that follow the W3C WebDriver specification and are also supported.
Additionally, support for GeckoDriver is best in Firefox 57 and greater, however the more recent the Firefox version, the better the experience as they contain more bug fixes and the recent features while some features will only be available in the latest Firefox Nightly with GeckoDriver.
This usecase
If you are working with the legacy Firefox releases (i.e. till Firefox 47.x) geckodriver still works but you have to explicitly set the property "marionette" to false as follows:
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False

Is it possible to use selenium on an arm64 device which has a linux server?

I'm trying to run selenium on an arm64 device with linux server, since I cannot install chrome on this device, I want to use chromium or firefox browser in headless mode. But I'm getting different errors every time I run my selenium program. here is the error log while using chromium:
/root/.cache/selenium/chromedriver/linux-arm64/101.0.4951.41/chromedriver: 1: Syntax error: "(" unexpected
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:585)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:248)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:164)
at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:93)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82)
at dev.emad.selenium.book.Main$Companion.main(Main.kt:43)
at dev.emad.selenium.book.Main.main(Main.kt)
Caused by: org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.1.3', revision: '7b1ebf28ef'
System info: host: 'FriendlyELEC', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'aarch64', os.version: '5.10.60', java.version: '11.0.14.1'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:226)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:98)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567)
... 8 more
I have tried xvfb but it didn't help, And here is he code that I'm using:
WebDriverManager.chromedriver().setup()
val chromeOptions = ChromeOptions().apply {
setHeadless(true)
addArguments(
"--disable-infobars",
"--disable-extensions",
"--disable-application-cache",
"--disable-gpu",
"--disable-dev-shm-usage",
"--dns-prefetch-disable",
"--ignore-ssl-errors",
"--ignore-certificate-errors",
"--no-sandbox",
"--window-size=1920,1080",
"--remote-debugging-port=9222"
)
}
chromeOptions.setBinary("/usr/bin/chromium-browser")
driver = ChromeDriver(chromeOptions)
driver.get("https://bing.com")

Trouble running Protractor tests using Selenium Server

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'}));
}
}

Webdriver doesn't stable and sometimes crashes during the running

Sometimes the webDriver stopped during the running and warn about "no session"/ "no window target" and etc..
I've used Protractor on Node.JS for my automated testing.
The errors are not Constantine and sometimes all the 200 test cases are work fine until the end of the running.
Error:
10:38:20.745 INFO - Executing: [get current url])
10:38:20.766 INFO - Done: [get current url]
10:38:20.799 INFO - Executing: [take screenshot])
10:38:21.299 INFO - Done: [take screenshot]
10:38:22.002 INFO - Executing: [get: http://app.vcita.com/auth/login])
10:38:27.870 INFO - Done: [get: http://app.vcita.com/auth/login]
10:38:29.917 INFO - Executing: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]])
10:38:30.009 INFO - Done: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]]
10:38:30.049 INFO - Executing: [is enabled: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -> css selector: [ng-click="connectWithGoogle()"]]])
10:38:30.148 INFO - Done: [is enabled: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -> css selector: [ng-click="connectWithGoogle()"]]]
10:38:30.243 INFO - Executing: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]])
10:38:30.341 INFO - Done: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]]
10:38:30.387 INFO - Executing: [is displayed: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -> css selector: [ng-click="connectWithGoogle()"]]])
10:38:30.467 INFO - Done: [is displayed: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -> css selector: [ng-click="connectWithGoogle()"]]]
10:38:30.523 INFO - Executing: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]])
10:38:30.569 INFO - Done: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]]
10:38:30.613 INFO - Executing: [click: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -> css selector: [ng-click="connectWithGoogle()"]]])
10:38:30.760 INFO - Done: [click: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -> css selector: [ng-click="connectWithGoogle()"]]]
10:38:32.812 INFO - Executing: [get window handles])
10:38:32.842 INFO - Done: [get window handles]
10:38:34.873 INFO - Executing: [get window handles])
10:38:34.908 INFO - Done: [get window handles]
10:38:34.961 INFO - Executing: [switch to window: CDwindow-FC9091C4-87E2-45A2-B125-D658EADF49ED])
10:38:35.009 INFO - Done: [switch to window: CDwindow-FC9091C4-87E2-45A2-B125-D658EADF49ED]
10:38:35.037 INFO - Executing: [find elements: By.id: choose-account-0])
10:38:38.163 WARN - Exception thrown
java.lang.NullPointerException
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:386)
at org.openqa.selenium.remote.RemoteWebDriver.findElementsById(RemoteWebDriver.java:397)
at org.openqa.selenium.By$ById.findElements(By.java:206)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:340)
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
at com.sun.proxy.$Proxy1.findElements(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.findElements(EventFiringWebDriver.java:173)
at org.openqa.selenium.remote.server.handler.FindElements.call(FindElements.java:49)
at org.openqa.selenium.remote.server.handler.FindElements.call(FindElements.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
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)
10:38:38.454 WARN - Exception: null
10:38:39.551 INFO - Executing: [take screenshot])
10:38:39.584 WARN - Exception thrown
org.openqa.selenium.NoSuchWindowException: no such window: target window already closed
from unknown error: web view not found
(Session info: chrome=48.0.2564.109)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 22 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'vCitaQA', ip: '10.0.0.5', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=C:\Users\idan\AppData\Local\Temp\scoped_dir9468_8071}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=48.0.2564.109, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 4c9896194733dc6b787bf75f84f48ec2
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:422)
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:622)
at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:324)
at org.openqa.selenium.remote.server.handler.CaptureScreenshot.call(CaptureScreenshot.java:35)
at org.openqa.selenium.remote.server.handler.CaptureScreenshot.call(CaptureScreenshot.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
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)
10:38:39.965 WARN - Exception: no such window: target window already closed
from unknown error: web view not found
(Session info: chrome=48.0.2564.109)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 22 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'vCitaQA', ip: '10.0.0.5', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=C:\Users\idan\AppData\Local\Temp\scoped_dir9468_8071}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=48.0.2564.109, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 4c9896194733dc6b787bf75f84f48ec2
Please help me to figure out why it happens and what the better solution to avoid it..
Thanks.
According to the chromedriver changelog, chromedriver 2.14 which you are using supports Chrome 39-42. I suspect there might be compatibility issues in your case because Chrome is brand new (version 48), but chromedriver is outdated.
Please upgrade Protractor to the, preferably, latest version and then run webdriver-manager update to update chromedriver as well.
As you are using chromedriver 2.14 please use chrome v39.0. The protractor version as 1.64.
This will solve your problem.

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.

Resources