Unable to execute selenium tests on chrome browser - google-chrome

Local:-
I am trying to run selenium tests on chrome browser.
Currently, another chrome browser is running and then running a test on chrome browser by opening new profile and getting the following error:-
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
System info: host: 'lima', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-97-generic', java.version: '1.8.0_72'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
at
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:19247 [localhost/127.0.0.1] failed: Connection refused
Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
System info: host: 'test', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-97-generic', java.version: '1.8.0_72'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 42 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:19247 [localhost/127.0.0.1] failed: Connection refused
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
... 43 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
... 56 more
Chrome driver configuration:-
ChromeOptions options = new ChromeOptions();
URL resource = getClass().getClassLoader().getResource("chromedriver");
setPermissiontoFile(resource);
System.setProperty("webdriver.chrome.driver",
Paths.get(resource.toURI()).toString());
options.addArguments("start-maximized");
caps.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(caps);
If I close the existing running chrome browser and then I run the selenium tests on chrome browser ,it works.
Jenkins:-
When I try to running on jenkins. I am getting the following error:-
Exception org.openqa.selenium.remote.UnreachableBrowserException
Message: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14' System info: host: 'jenkins, ip: '10.62.1.24', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-504.1.3.el6.x86_64', java.version: '1.7.0_85' Driver info: driver.version: ChromeDriver
Stacktrace:
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:178)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:27419 [localhost/127.0.0.1] failed: Connection refused
Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
System info: host: 'jenkins-sandbox.qa.us-west-2.aws.vrv', ip: '10.62.1.24', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-504.1.3.el6.x86_64', java.version: '1.7.0_85'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
... 42 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:27419 [localhost/127.0.0.1] failed: Connection refused
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
... 43 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
... 56 more
What is the problem here, Can anyone help me to solve this ?

I am able run selenium tests on chrome browser with already existing chrome browser running. I did upgrading selenium-java from 2.48.0 to 2.48.1
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.48.1</version>
</dependency>
Refer here https://github.com/seleniumhq/selenium/issues/1123

Related

protractor woant run my scripts

i just try to run my 1st protractor so i just get the code from here
and i code in eclipse and i convert tern project as well and then i cd to my project then i type this code
protractor conf.js
then i got this error
(node:9552) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[10:17:07] I/launcher - Running 1 instances of WebDriver
[10:17:07] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[10:17:07] E/launcher - unknown error: Chrome failed to start: exited abnormally
(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.)
(Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-29-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 63 milliseconds
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z'
System info: host: 'groot', ip: '192.168.2.8', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-29-generic', java.version: '1.8.0_171'
Driver info: driver.version: unknown
[10:17:07] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
(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.)
(Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-29-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 63 milliseconds
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z'
System info: host: 'groot', ip: '192.168.2.8', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-29-generic', java.version: '1.8.0_171'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:761:15)
at createDriver (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:626:16)
at Hosted.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:195:43)
at q.then.then (/usr/local/lib/node_modules/protractor/built/runner.js:339:29)
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)
[10:17:07] E/launcher - Process exited with error code 199
note : web driver is running and i have chrome Version 67.0.3396.87 (Official Build) (64-bit)
and my os is ubuntu how can i fix this? thank you for your time
Try adding the chrome option --no-sandbox in your config
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--no-sandbox']
}
},

Starting ChromeDriver 2.35.528157 () on port 25267 Only local connections are allowed

Please help me to resolve problem with Selenium and ChromeDriver. I have problem when using MacOS
eclipse Oxygen
java 1.8
selenium 3.9.1
chromedriver 2.35
the message is:
Starting ChromeDriver 2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef) on port 25267
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created exception
from disconnected: unable to connect to renderer
(Session info: chrome=64.0.3282.186)
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.13.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 527 milliseconds
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:22.379Z'
System info: host: 'S-MIS-DAILV-2.local', ip: 'fe80:0:0:0:4f0:884f:5322:f47f%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.2', java.version: '1.8.0_162'
Driver info: driver.version: ChromeDriver
Thank so much for view this question.

ChromeDriver hanging sporadically, DevTools request failed. Chrome not reachable error

Tests fail sporadically with the error of "Chrome not reachable".
Throwing a WebDriver exception: chrome not reachable
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.26 seconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXX', ip: 'XXXXXXXXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: Driver
Exception : org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXX', ip: 'XXXXXXXXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: Driver
[ERROR] Driver Initialize - Error initializing driver for browser 'CHROME'. chrome not reachable
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.26 seconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXXXX', ip: 'XXXXXXXXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: Driver
org.openqa.selenium.WebDriverException: chrome not reachable
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.26 seconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXX', ip: 'XXXXXXXXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: Driver
When I do some logging I see the error is with the DevTools request failing. This happens sporadically. It looks like chromedriver creates a new port for debugging for each test and sometimes Chromedriver can't connect to the new port. Not sure why and don't know how to fix it. Anyone experience this?
[1516896066.375][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --load-extension="C:\Users\mna7158\AppData\Local\Temp\scoped_dir6732_10840\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12923 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\mna7158\AppData\Local\Temp\scoped_dir6732_15347" data:,
[1516896066.431][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896068.429][DEBUG]: DevTools request failed
[1516896068.480][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896068.688][DEBUG]: DevTools request failed
[1516896068.739][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896070.481][DEBUG]: DevTools request failed
[1516896070.532][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896070.742][DEBUG]: DevTools request failed
[1516896070.793][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896072.532][DEBUG]: DevTools request failed
Specifications:
Chrome version 64 (64 bit)
OS = Windows 7
Chromedriver 2.35
Selenium-Java 3.7.1
Sample code that I get this error with.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class chromeDriverExample {
public WebDriver driver;
WebDriverWait wait;
#BeforeMethod
public void beforeMethod() {
System.setProperty("webdriver.chrome.driver", "src//test//resources//drivers//chromedriver.exe");
System.setProperty("webdriver.chrome.verboseLogging", "true");
driver = new ChromeDriver();
wait = new WebDriverWait(driver, 30);
}
#AfterMethod
public void afterMethod() {
driver.close();
driver.quit();
}
#Test(invocationCount = 15)
public void chromeTest() {
driver.get("https://google.com");
wait.until(ExpectedConditions.presenceOfElementLocated(By.name("q")));
}
}
This may or may not be related but I am seeing something similar. Since my local Chrome auto updated (macOS) to v64 we are seeing quite sporadic Selenium TimeoutExceptions. If I fudge my Chrome version and pin it at version 63, this doesn't happen. Something has been broken or changed in v64, but i'm struggling to pin what. I don't know if a new ChromeDriver is imminent and will fix it though.

Executing get - Exception thrown for selenium standalone with chrome driver

Intro
I have selenium standalone running:
java -jar ./selenium-server-standalone-3.4.0.jar
I have chromedriver at the same working directory.
I create chrome session:
curl -XPOST -d'{"capabilities":{"desiredCapabilities":{"browserName":"chrome"}},"desiredCapabilities":{"browserName":"chrome"}}' http://127.0.0.1:4444/wd/hub/session
{"state":null,"sessionId":"d33f687e-62c2-4147-aab1-a1c1bba29aed","hCode":1317400713,"value":{"applicationCacheEnabled":false,"rotatable":false,"networkConnectionEnabled":true,"chrome":{"userDataDir":"/tmp/.com.google.Chrome.w26Qkk"},"takesHeapSnapshot":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":true,"version":"57.0.2987.133","platform":"LINUX","browserConnectionEnabled":false,"nativeEvents":true,"acceptSslCerts":true,"webdriver.remote.sessionid":"d33f687e-62c2-4147-aab1-a1c1bba29aed","locationContextEnabled":true,"webStorageEnabled":true,"browserName":"chrome","takesScreenshot":true,"javascriptEnabled":true,"cssSelectorsEnabled":true},"class":"org.openqa.selenium.remote.Response","status":0}
I see chrome is opened with message:
You are using an unsupported command-line flag: -ignore-certificate-errors. Stability and security will suffer.
Problem
Then I try to open an url in chrome:
curl -XPOST -d'{"url":"http://stackoverflow.com"}' http://127.0.0.1:4444/wd/hub/session/d33f687e-62c2-4147-aab1-a1c1bba29aed/url
I get response
And chrome browser does NOT open the URL.
Selenium stand alone output for get URL command:
08:32:33.405 INFO - Executing: [get: http://stackoverflow.com])
08:32:34.255 WARN - Exception thrown
org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"5244.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=57.0.2987.133)
(Driver info: chromedriver=2.9.248304,platform=Linux 4.2.0-27-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 64 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'np', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-27-generic', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, chrome={userDataDir=/tmp/.com.google.Chrome.w26Qkk}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=57.0.2987.133, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 6d5d29b199469d31ecf04abcfbea2493
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:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:364)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:104)
at com.sun.proxy.$Proxy4.get(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.get(EventFiringWebDriver.java:163)
at org.openqa.selenium.remote.server.handler.ChangeUrl.call(ChangeUrl.java:40)
at org.openqa.selenium.remote.server.handler.ChangeUrl.call(ChangeUrl.java:25)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
08:32:34.288 WARN - Exception: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"5244.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=57.0.2987.133)
(Driver info: chromedriver=2.9.248304,platform=Linux 4.2.0-27-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 64 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'np', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-27-generic', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, chrome={userDataDir=/tmp/.com.google.Chrome.w26Qkk}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=57.0.2987.133, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 6d5d29b199469d31ecf04abcfbea2493
With firefox it works
The same actions work well for firefox and geckodriver:
curl -XPOST -d'{"capabilities":{"desiredCapabilities":{"browserName":"firefox"}},"desiredCapabilities":{"browserName":"firefox"}}' http://127.0.0.1:4444/wd/hub/session
and
curl -XPOST -d'{"url":"http://stackoverflow.com"}' http://127.0.0.1:4444/wd/hub/session/73835d43-d566-4e88-bcab-1f45ff4db129/url
And I see stackoverflow.com opened in firefox browser.
Versions
Google chrome and chrome driver versions:
google-chrome -version
Google Chrome 57.0.2987.133
./chromedriver -version
Starting ChromeDriver (v2.9.248304) on port 9515
Operating system:
Ubuntu 14.04
According to your stacktrace, you are using an old ChromeDriver 2.9. But, according to the ChromeDriver downloads page, for Chrome 57, you should be using ChromeDriver 2.29.

Chrome on remote webdriver (via Grid) failed to start

I'm having trouble launching Cucumber test with Chrome using remote webdriver capabilities on Grid (1 linux hub and 1 linux node with Firefox and Chrome). Firefox test go very well but Chrome returns the following error:
unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The server did not provide any stacktrace information)
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Command duration or timeout: 20.67 seconds
Build info: version: '2.30.0', revision: 'dc1ef9c', time: '2013-02-19 00:15:27'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae', java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver (org.openqa.selenium.WebDriverException) (Selenium::WebDriver::Error::UnknownError)
The browser is initialized as:
$profile = Selenium::WebDriver::Chrome::Profile.new
$profile['download.prompt_for_download'] = false
$profile['download.default_directory'] = downloads_path
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
platform: "Linux",
version: "",
"chrome.profile" => $profile)
browser = Watir::Browser.new(
:remote,
:url => 'http://aut.theurl.net:4444/wd/hub',
:desired_capabilities => capabilities)
More information:
I tried chromedriver versions 2.3 and 2.2 and selenium-server-standalone 2.35 and 2.3 unsuccessfully.
Though terminal, chromedriver starts successfully, so paths seems to be ok.
It seems that Chrome starts on the remote node but immediately fails. I'm a little out of ideas, so any thought or guidance is welcome.
Thanks in advance!
===================================
UPDATE: added more console log information. Maybe there were more information here but I can't see anything valuable.
11:45:47.612 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae', java.version: '1.7.0_25'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
(...)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae', java.version: '1.7.0_25'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:72)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:56)
(...)
Caused by: java.lang.reflect.InvocationTargetException
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.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:62)
... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.53 seconds
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae', java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
(...)
11:45:47.612 WARN - Exception: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.53 seconds
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae', java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Finally, it works!
I changed two things:
use a different chromedriver (linux64 instead of linux32)
include the chromedriver path on the command using Dwebdriver.chrome.driver switch:
java -jar ./selenium-server-standalone-2.35.0.jar - Dwebdriver.chrome.driver='/opt/drivers/chromedriver' -role webdriver -hub http://192.168.1.10:4444/grid/register -port 5566 -browser browserName=chrome,maxInstances=5,platform=LINUX &
Thank you very much for your reference :)