protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Unable to start a webdriver session for chrome

Open iamblackheat opened this issue 11 years ago • 33 comments

I am a new comer to protractor and I got problem trying to using protractor with webdriver. I installed protractor and did "webdriver-manager update" to get selenium server and chromedriver and iedriver downloaded.

Then I start the selenium standalone server at local (127.0.0.1:4444) then try to perform testing with "protractor conf.js", then I got following error message.

$ protractor conf.js Using the selenium server at http://127.0.0.1:4444/wd/hub [launcher] Running 1 instances of WebDriver ERROR - Unable to start a WebDriver session.

c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\node_modules\seleniu m-webdriver\lib\atoms\error.js:113 var template = new Error(this.message); ^ UnknownError: null at new bot.Error (c:\Users\dc\AppData\Roaming\npm\node_modules\protracto r\node_modules\selenium-webdriver\lib\atoms\error.js:113:18) at Object.bot.response.checkResponse (c:\Users\dc\AppData\Roaming\npm\no de_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106: 9) at c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\node_modules
selenium-webdriver\lib\webdriver\webdriver.js:152:24 at c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\node_modules
selenium-webdriver\lib\goog\base.js:1582:15 at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (c:\Users\do ncui\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver \lib\webdriver\promise.js:1654:20) at notify (c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\node_ modules\selenium-webdriver\lib\webdriver\promise.js:465:12) at notifyAll (c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\no de_modules\selenium-webdriver\lib\webdriver\promise.js:442:7) at resolve (c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\node _modules\selenium-webdriver\lib\webdriver\promise.js:420:7) at fulfill (c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\node modules\selenium-webdriver\lib\webdriver\promise.js:535:5) at c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\node_modules
selenium-webdriver\lib\goog\base.js:1582:15 ==== async task ==== WebDriver.createSession() at Function.webdriver.WebDriver.acquireSession
(c:\Users\dc\AppData\Roa ming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\w ebdriver.js:149:22) at Function.webdriver.WebDriver.createSession (c:\Users\dc\AppData\Roami ng\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\web driver.js:123:30) at Builder.build (c:\Users\dc\AppData\Roaming\npm\node_modules\protracto r\node_modules\selenium-webdriver\builder.js:294:22) at DriverProvider.getNewDriver (c:\Users\dc\AppData\Roaming\npm\node_mod ules\protractor\lib\driverProviders\driverProvider.js:38:7) at Runner.createBrowser (c:\Users\dc\AppData\Roaming\npm\node_modules\pr otractor\lib\runner.js:180:37) at c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\lib\runner.js :257:21 at _fulfilled (c:\Users\dc\AppData\Roaming\npm\node_modules\protractor\n ode_modules\q\q.js:797:54) at self.promiseDispatch.done (c:\Users\dc\AppData\Roaming\npm\node_modul es\protractor\node_modules\q\q.js:826:30) at Promise.promise.promiseDispatch (c:\Users\dc\AppData\Roaming\npm\node _modules\protractor\node_modules\q\q.js:759:13) [launcher] Process exited with error code 1

iamblackheat avatar Mar 06 '15 16:03 iamblackheat

the content of conf.js

// conf.js exports.config = { seleniumAddress: 'http://127.0.0.1:4444/wd/hub', specs: ['spec.js'], capabilities: { browserName: 'chrome', chromeOptions: { binary: 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe', args: [], extensions: [], } }
};

iamblackheat avatar Mar 06 '15 16:03 iamblackheat

I assume you start WebDriver with webdriver-manager start?

If so, I cannot reproduce this with your config. Maybe adding spec.js (partially) would help.

jabbink avatar Mar 06 '15 16:03 jabbink

I just use this tutorial to pratice http://angular.github.io/protractor/#/tutorial and the content of spec.js // spec.js describe('angularjs homepage', function() { it('should have a title', function() { browser.get('http://juliemr.github.io/protractor-demo/');

expect(browser.getTitle()).toEqual('Super Calculator');

}); });

iamblackheat avatar Mar 06 '15 19:03 iamblackheat

I guess the problem lies in chromedriver or chrome.exe. But it should be no wrong in chromedriver as it is downloaded by webdriver-manager.

iamblackheat avatar Mar 06 '15 19:03 iamblackheat

Hmmm, works for me :cry:

jabbink avatar Mar 06 '15 20:03 jabbink

where is the chrome.exe in your machine? and what OS do you have?

iamblackheat avatar Mar 06 '15 20:03 iamblackheat

In my own Protractor tests I do not even specify the location of the Chrome-executable, but I did try to specify it as you did.

I use Windows 7 (x64) with Chrome 40.0.2214.115 m (located on exactly the same path as your copy) in combination with node v0.12.0 and webdriver-manager gives me 21:35:11.109 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf.

I tried both http://localhost:4444/wd/hub as I did your option with 127.0.0.1: both work.

jabbink avatar Mar 06 '15 20:03 jabbink

Please run your test with the --troubleshoot and post the output.

juliemr avatar Mar 10 '15 22:03 juliemr

I try to use --troubleshoot but it is not accepted. C:\Users\doncui\protractor_test>protractor --troubleshoot conf.js **you must either specify a configuration file or at least 3 options. See below for the options:

Usage: protractor [options] [configFile] configFile defaults to protractor.conf.js The [options] object will override values from the config file. See the reference config for a full list of options.

Options: --help Print Protractor help menu

--version Print Protractor version

--browser, --capabilities.browserName Browsername, e.g. chrome or firefox --seleniumAddress A running selenium address to use --seleniumServerJar Location of the standalone selenium jar file --seleniumPort Optional port for the selen ium standalone server --baseUrl URL to prepend to all relat ive paths --rootElement Element housing ng-app, if not html or body --specs Comma-separated list of fil es to test --exclude Comma-separated list of fil es to exclude --verbose, --jasmineNodeOpts.isVerbose Print full spec names

--stackTrace, --jasmineNodeOpts.includeStackTrace Print stack trace on error

--params Param object to be passed t o the tests --framework Test framework to use: jasm ine, cucumber or mocha --resultJsonOutputFile Path to save JSON test resu lt --troubleshoot Turn on troubleshooting out put --elementExplorer Interactively test Protract or commands

iamblackheat avatar Mar 11 '15 13:03 iamblackheat

The --troubleshoot parameter requires an argument, so try:

protractor --troubleshoot true conf.js

tullmann avatar Mar 11 '15 17:03 tullmann

C:\Users\doncui\protractor_test>protractor --troubleshoot true conf.js DEBUG - Running with --troubleshoot DEBUG - Protractor version: 1.8.0 DEBUG - Your base url for tests is undefined Using the selenium server at http://127.0.0.1:4444/wd/hub [launcher] Running 1 instances of WebDriver ERROR - Unable to start a WebDriver session.

C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\node_modules\seleniu m-webdriver\lib\atoms\error.js:113 var template = new Error(this.message); ^ UnknownError: null at new bot.Error (C:\Users\doncui\AppData\Roaming\npm\node_modules\protracto r\node_modules\selenium-webdriver\lib\atoms\error.js:113:18) at Object.bot.response.checkResponse (C:\Users\doncui\AppData\Roaming\npm\no de_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106: 9) at C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\node_modules
selenium-webdriver\lib\webdriver\webdriver.js:152:24 at C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\node_modules
selenium-webdriver\lib\goog\base.js:1582:15 at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\do ncui\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver \lib\webdriver\promise.js:1654:20) at notify (C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\node_ modules\selenium-webdriver\lib\webdriver\promise.js:465:12) at notifyAll (C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\no de_modules\selenium-webdriver\lib\webdriver\promise.js:442:7) at resolve (C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\node _modules\selenium-webdriver\lib\webdriver\promise.js:420:7) at fulfill (C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\node modules\selenium-webdriver\lib\webdriver\promise.js:535:5) at C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\node_modules
selenium-webdriver\lib\goog\base.js:1582:15 ==== async task ==== WebDriver.createSession() at Function.webdriver.WebDriver.acquireSession
(C:\Users\doncui\AppData\Roa ming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\w ebdriver.js:149:22) at Function.webdriver.WebDriver.createSession (C:\Users\doncui\AppData\Roami ng\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\web driver.js:123:30) at Builder.build (C:\Users\doncui\AppData\Roaming\npm\node_modules\protracto r\node_modules\selenium-webdriver\builder.js:294:22) at DriverProvider.getNewDriver (C:\Users\doncui\AppData\Roaming\npm\node_mod ules\protractor\lib\driverProviders\driverProvider.js:38:7) at Runner.createBrowser (C:\Users\doncui\AppData\Roaming\npm\node_modules\pr otractor\lib\runner.js:180:37) at C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\lib\runner.js :257:21 at _fulfilled (C:\Users\doncui\AppData\Roaming\npm\node_modules\protractor\n ode_modules\q\q.js:797:54) at self.promiseDispatch.done (C:\Users\doncui\AppData\Roaming\npm\node_modul es\protractor\node_modules\q\q.js:826:30) at Promise.promise.promiseDispatch (C:\Users\doncui\AppData\Roaming\npm\node _modules\protractor\node_modules\q\q.js:759:13) [launcher] Process exited with error code 1

iamblackheat avatar Mar 12 '15 08:03 iamblackheat

I'm guessing this is an issue with where your Chrome binary is. Can you check and make sure it's at C:/Program Files (x86)/Google/Chrome/Application/chrome.exe? Can you run other browsers?

juliemr avatar Mar 16 '15 23:03 juliemr

The path is correct. I can run firefox and IE successfully.

Br/Dongbo

2015-03-17 0:18 GMT+01:00 Julie Ralph [email protected]:

I'm guessing this is an issue with where your Chrome binary is. Can you check and make sure it's at C:/Program Files (x86)/Google/Chrome/Application/chrome.exe? Can you run other browsers?

— Reply to this email directly or view it on GitHub https://github.com/angular/protractor/issues/1905#issuecomment-81985393.

iamblackheat avatar Mar 17 '15 08:03 iamblackheat

Not sure what to say - we can't reproduce the problem. It's an issue with chromedriver, chrome, or the selenium standalone server. Can you try reinstalling them?

I'm going to close this issue sine it's not a general problem, but we can keep discussing here.

juliemr avatar Mar 17 '15 16:03 juliemr

I'm having the same problem, but with a different configuration and OS (Linux), see relevant parts here: https://gist.github.com/orbitbot/b544d61fa4f51ed5170e. Confusingly my setup is working fine on my linux development machine, but is failing on a CI machine, while still using the same commands and same npm package versions...

On my development machine I can successfully run tests manually (with browsersync running) with ./node_modules/protractor/bin/protractor --troubleshoot true config/protractor.conf --baseUrl 'http://localhost:3000/#/' --specs test/integration/app.spec.js, but the development machine fails with

$ ./node_modules/protractor/bin/protractor --troubleshoot true config/protractor.conf --baseUrl 'http://localhost:3000/#/' --specs test/integration/app.spec.js DEBUG - Running with --troubleshoot DEBUG - Protractor version: 2.0.0 DEBUG - Your base url for tests is http://localhost:3000/#/ Starting selenium standalone server... [launcher] Running 1 instances of WebDriver Selenium standalone server started at http://192.168.1.10:33998/wd/hub ERROR - Unable to start a WebDriver session.

/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113   var template = new Error(this.message);                  ^ UnknownError: unknown error: Chrome failed to start: exited abnormally   (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 3.11.0-26-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.90 seconds Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System info: host: 'mule', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.11.0-26-generic', java.version: '1.7.0_51' Driver info: org.openqa.selenium.chrome.ChromeDriver     at new bot.Error (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)     at Object.bot.response.checkResponse (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)     at /var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:158:24     at [object Object].promise.ControlFlow.runInFrame_ (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)     at [object Object].promise.Callback_.goog.defineClass.notify (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2464:25)     at [object Object].promise.Promise.notify_ (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:563:12)     at Array.forEach (native)     at Object.goog.array.forEach (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/array/array.js:203:43)     at [object Object].promise.Promise.notifyAll_ (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:552:16)     at [object Object].goog.async.run.processWorkQueue as _onTimeout From: Task: WebDriver.createSession()     at Function.webdriver.WebDriver.acquireSession_ (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/seleni

Firefox also works on development machine, but not on CI (in both cases by just changing capabilities.browserName to 'firefox' in protractor.conf):

ERROR - Unable to start a WebDriver session.

/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113   var template = new Error(this.message);                  ^ UnknownError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

(process:4534): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed Error: no display specified

(process:4542): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed Error: no display specified

    at new bot.Error (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113:18)     at Object.bot.response.checkResponse (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)     at /var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:158:24     at [object Object].promise.ControlFlow.runInFrame_ (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)     at [object Object].promise.Callback_.goog.defineClass.notify (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2464:25)     at [object Object].promise.Promise.notify_ (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:563:12)     at Array.forEach (native)     at Object.goog.array.forEach (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/array/array.js:203:43)     at [object Object].promise.Promise.notifyAll_ (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:552:16)     at [object Object].goog.async.run.processWorkQueue as _onTimeout From: Task: WebDriver.createSession()     at Function.webdriver.WebDriver.acquireSession_ (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:155:22)     at Function.webdriver.WebDriver.createSession (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:129:30)     at [object Object].Builder.build (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/selenium-webdriver/builder.js:416:22)     at [object Object].DriverProvider.getNewDriver (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)     at [object Object].Runner.createBrowser (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/lib/runner.js:180:37)     at /var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/lib/runner.js:257:21     at _fulfilled (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/q/q.js:797:54)     at self.promiseDispatch.done (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/q/q.js:826:30)     at Promise.promise.promiseDispatch (/var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/q/q.js:759:13)     at /var/lib/jenkins/jobs/aloha/workspace/node_modules/protractor/node_modules/q/q.js:573:44 [launcher] Process exited with error code 1

orbitbot avatar Apr 29 '15 14:04 orbitbot

Have you tried run webdriver-manager update?

Installing chromedriver manually might help as well:

  • download chromedriver (https://code.google.com/p/selenium/wiki/ChromeDriver)
  • extract
  • put the chromedriver file into your windows/system32 folder

jirikuchta avatar May 05 '15 07:05 jirikuchta

I'm receiving the same error as @orbitbot and @iamblackheat. I'm on Linux.

cboden avatar May 20 '15 15:05 cboden

Also experiencing the same issue as @orbitbot, @iamblackheat, and @cboden. Windows, with webdriver-manager up to date.

Edit: I finally resolved it by downgrading protractor to v1.8.0

JayHuang avatar May 26 '15 00:05 JayHuang

You probably have java 8 installed, remove it and install java 7.

gilamran avatar Jun 09 '15 15:06 gilamran

Just to add a helpful note: Instead of passing --troubleshoot true to the command line, which does not work for me, this can also be specified in the configuration file: troubleshoot: true,

koh-osug avatar Jul 17 '15 01:07 koh-osug