Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
966 views
in Technique[技术] by (71.8m points)

angularjs - SessionNotCreatedError: Unable to create new service: ChromeDriverService

We have AngularJS protractor tests. The process is to set up and run these steps in order:

$ npm install
$ webdriver-manager update --ie32 --ignore_ssl
$ gulp

The problem I'm having is this setup works for everyone else on my team but 100% of the time I receive this error:

[11:42:33] I/local - Starting selenium standalone server...
[11:42:36] I/local - Selenium standalone server started at http://10.222.189.129:55574/wd/hub

/path/to/repo/node_modules/selenium-webdriver/lib/error.js:27
    super(opt_error);
    ^
SessionNotCreatedError: Unable to create new service: ChromeDriverService
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z'
System info: host: 'xxxx', ip: 'xxxx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_131'
Driver info: driver.version: unknown
   at WebDriverError (/path/to/repo/node_modules/selenium-webdriver/lib/error.js:27:5)
   at SessionNotCreatedError (/path/to/repo/node_modules/selenium-webdriver/lib/error.js:214:5)
   at Object.checkLegacyResponse (/path/to/repo/node_modules/selenium-webdriver/lib/error.js:505:15)
   at parseHttpResponse (/path/to/repo/node_modules/selenium-webdriver/lib/http.js:509:13)
   at doSend.then.response (/path/to/repo/node_modules/selenium-webdriver/lib/http.js:440:13)
   at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
   at Function.createSession (/path/to/repo/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
   at Function.createSession (/path/to/repo/node_modules/selenium-webdriver/chrome.js:709:29)

The problem is something to do with my setup but I'm at a loss, so throwing a Hail Mary on SO hoping anyone has any advice.

Please let me know if you need any additional info. Thank you in advance, I've wasted a lot of time trying to get this to work!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This can be fixed by updating to the latest version of both chromedriver and chrome.

If you are using webdriver-manager, run

webdriver-manager update --chromedriver

Then download Chrome from https://www.google.com/chrome/browser/desktop/ and replace your old chrome with the latest version.

You will also need to Ctrl-C in the terminal where webdriver is running and run

webdriver-manager start

Or kill and restart the Selenium daemon process to capture the latest chromedriver. A system restart might be helpful.

Also worth trying:

npm update -g protractor
webdriver-manager update

Also see session not created exception for chrome in Protractor for more details on how to modify the version of Chromedriver in protractor's config

Lastly, make sure that your protractor.conf.js has

   commonCapabilities: {
     'browserName': 'chrome',
   },

or else you should be using

--browser chrome

flag on your protractor command


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...