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.
Related
I'm running a java webapp in Apache Tomcat/10.0.23 on a remote server which implements selenium chromedriver. Whenever I create the webdriver it returns a HTTP Status 500 – Internal Server Error.
Google-chrome location:
/usr/bin/google-chrome /usr/share/man/man1/google-chrome.1.gz
Google-chrome version:
110.0.5481.77
Chromedriver location:
/usr/bin/chromedriver
Chromedriver version:
110.0.5481.77 (65ed616c6e8ee3fe0ad64fe83796c020644d42af-refs/branch-heads/5481#{#839})
Selenium
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.8.0</version>
</dependency>
Error:
<body>
<h1>HTTP Status 500 – Internal Server Error</h1>
<hr class="line" />
<p><b>Type</b> Exception Report</p>
<p><b>Message</b> Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start:
crashed.</p>
<p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.
</p>
<p><b>Exception</b></p>
<pre>org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Host info: host: 'ip-xxxxxxxxxx2', ip: '127.0.0.1'
Build info: version: '4.8.0', revision: '267030adea'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.0-21-cloud-amd64', java.version: '11.0.15.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless=new, --disable-dev-shm-usage, --no-sandbox], extensions: []}, pageLoadStrategy: eager}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [--headless=new, --disable-dev-shm-usage, --no-sandbox], extensions: []}, pageLoadStrategy: eager}}]
org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:148)
org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106)
org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229)
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:157)
org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:101)
org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82)
org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:71)
com.fourdcontrols.servlets.TestServlet.doGet(TestServlet.java:29)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:668)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
</pre>
<p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p>
<hr class="line" />
<h3>Apache Tomcat/10.0.23</h3>
</body>
Logs:
Starting ChromeDriver 110.0.5481.77 (65ed616c6e8ee3fe0ad64fe83796c020644d42af-refs/branch-heads/5481#{#839}) on port 3125
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Thumb rule
A common cause for Chrome to crash during startup is running Chrome as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Chrome as a regular user instead.
References
You can find a couple of relevant detailed discussion and documentation in:
WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser
Chrome doesn't start or crashes immediately
I'm running WebStorm 2022.2.2 on Windows and my Node.js project is sitting in WSL2 Ubuntu distribution, and I'm trying to get the debugger working for my setup with no success so far.
This is the error popping up as soon as I press the debug button:
2022-09-24 11:38:49,751 [61701563] INFO - #c.i.j.d.JavaScriptDebugProcess - JSDebugger publish port: 58315
2022-09-24 11:38:49,861 [61701673] INFO - #c.i.e.r.ExecutionUtil - Error running 'my-project:dev':<br>Failed to prepare environment: File is not executable: /mnt/c/Users/MyPC/AppData/Local/JetBrains/Toolbox/apps/WebStorm/ch-0/222.4167.31/bin/wslproxy (C:\Users\MyPC\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.4167.31\bin\wslproxy)
com.intellij.execution.ExecutionException: Failed to prepare environment: File is not executable: /mnt/c/Users/MyPC/AppData/Local/JetBrains/Toolbox/apps/WebStorm/ch-0/222.4167.31/bin/wslproxy (C:\Users\MyPC\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.4167.31\bin\wslproxy)
at com.intellij.javascript.nodejs.execution.NodeTargetRun.prepareCommandLine(NodeTargetRun.kt:129)
at com.intellij.javascript.nodejs.execution.NodeTargetRun.startProcessEx(NodeTargetRun.kt:138)
at com.intellij.javascript.nodejs.execution.NodeTargetRun.startProcess(NodeTargetRun.kt:103)
at com.github.iguissouma.nxconsole.buildTools.rc.NxRunProfileState.startProcess(NxRunProfileState.kt:70)
at com.intellij.javascript.nodejs.execution.NodeBaseRunProfileState$Companion.runInBackground(NodeBaseRunProfileState.kt:58)
at com.intellij.javascript.nodejs.execution.NodeBaseRunProfileState$Companion.access$runInBackground(NodeBaseRunProfileState.kt:41)
at com.intellij.javascript.nodejs.execution.NodeBaseRunProfileState$Companion$executeUnderProgress$1.run(NodeBaseRunProfileState.kt:49)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.Exception: File is not executable: /mnt/c/Users/MyPC/AppData/Local/JetBrains/Toolbox/apps/WebStorm/ch-0/222.4167.31/bin/wslproxy (C:\Users\MyPC\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\222.4167.31\bin\wslproxy)
at com.intellij.execution.wsl.WslToolsKt.getTool(WslTools.kt:17)
at com.intellij.execution.wsl.WslProxy.<init>(WslProxy.kt:101)
at com.intellij.execution.wsl.target.WslTargetEnvironment.getWslPort(WslTargetEnvironment.kt:88)
at com.intellij.execution.wsl.target.WslTargetEnvironment.<init>(WslTargetEnvironment.kt:79)
at com.intellij.execution.wsl.target.WslTargetEnvironmentRequest.prepareEnvironment(WslTargetEnvironmentRequest.kt:68)
at com.intellij.javascript.nodejs.execution.NodeTargetRun.prepareCommandLine(NodeTargetRun.kt:122)
... 26 more
Caused by: com.intellij.execution.wsl.ProcessExistedNotZeroException: Can't execute test -x /mnt/c/Users/MyPC/AppData/Local/JetBrains/Toolbox/apps/WebStorm/ch-0/222.4167.31/bin/wslproxy: 1.
at com.intellij.execution.wsl.WslProcessToolsKt.waitProcess(WslProcessTools.kt:37)
at com.intellij.execution.wsl.WslProcessToolsKt.runCommand(WslProcessTools.kt:19)
at com.intellij.execution.wsl.WslProcessToolsKt.runCommand$default(WslProcessTools.kt:14)
at com.intellij.execution.wsl.WslToolsKt.getTool(WslTools.kt:14)
... 31 more
What do I have to do in order to get the Debugger working?
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.
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'}));
}
}
I have the following setup:
protractor running from a windows vm using a stand alone selenium server on a linux headless box.
The idea was to have chrome installed on my windows vm and to have protractor use this chrome install to run the tests via the selenium on the linux box. I start the selenium server on the linuxx box using webdriver-manager start.
When I run the tests from the VM I get the folloiwng error
Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 2.6.32-431.29.2.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 134 milliseconds
Build info: version: '2.45.0',java.version: '1.7.0_79'
Driver info: org.openqa.selenium.chrome.ChromeDriver
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.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)
... 14 more
10:39:09.119 WARN - Exception: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 2.6.32-431.29.2.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 134 milliseconds
java.version: '1.7.0_79'
Driver info: org.openqa.selenium.chrome.ChromeDriver
In my protractor conf I it configured to use the selenium standalone server by specifying the selenium url.
Any ideas how to resolve this and get the browser to be opened on my windows vm rather than the linux box looking for the chrome binary.
Thanks