protractor/selenium "could not find chromedriver at" (on Windows)

68,379

Solution 1

If you are behind a proxy then try setting proxy first and then run webdriver update:

npm config set proxy http://<proxy.com>:port

webdriver-manager update

Solution 2

I was facing this error too and by the time I read the tutorial, it did not cover how to install protractor and the webdriver as local dependencies to your project (which are located in ./node_modules).

If this is what you prefer (probably because you might want to use grunt-protractor-runner and run your test later in a continuous build manner as I neede) instead of installing it globally, this solution worked for me:

  1. Install protractor:

npm install protractor --save-dev

  1. Install selenium and the webdrivers with the webdriver-manager by running:

./node_modules/protractor/bin/webdriver-manager update

After calling this command have a look at ./node_modules/protractor and it subfolders to verify it. A folder called selenium with the chromedriver in should be available in it.

Note that as protractor was not installed as "global", calling it from the command line will result in a "commnad not found" error. You can run it instead with this command: ./node_modules/protractor/bin/protractor

Additionaly, it might be a good idea to add a script definition to your package.json, so that next time you install all your dependencies from zero, npm setup the webdrivers automaticaly. For that add this to your package.json file: "scripts": { "postinstall": "./node_modules/protractor/bin/webdriver-manager update" }

Hope this helps you further...

Solution 3

I followed that tutorial and had the same problem. The issue here was that you need to specify the path to your selenium jar and chrome driver exe in your protractor config file. Mine was installed globally in AppData folder so this is what mine protractor.confg.js file looks like:

exports.config = {

specs: [
    'test/e2e/**/*.js'
],

chromeDriver: 'C:/Users/<username>/AppData/Roaming/npm/node_modules/protractor/selenium/chromedriver.exe',

seleniumServerJar: 'C:/Users/<username>/AppData/Roaming/npm/node_modules/protractor/selenium/selenium-server-standalone-2.40.0.jar',

baseUrl: 'http://localhost:9000/'

};

That seemed to do the trick.

Solution 4

Jeez, so many answers...

On the Mac, this worked for me:

$ npm install chromedriver
$ ln -sf ~/angular-phonecat/node_modules/chromedriver/bin/chromedriver node_modules/protractor/selenium/chromedriver.exe

There's GOT to be a better way of fixing it but at least this let me move on.

Solution 5

After looking around for a while, I noticed that the package.json file included in the angular phonecat repo defines a update-webdriver task.

Running that task (with npm run update-webdriver) fixed protractor for me.

Share:
68,379

Related videos on Youtube

Andresch Serj
Author by

Andresch Serj

Senior Full-Stack Developer that loves Angular/Typescript/NestJs and Bicycles. Loves Test Driven, Domain Driven, Component Driven and even Behaviour Driven. Loves T-Shaped Teams.

Updated on July 09, 2022

Comments

  • Andresch Serj
    Andresch Serj almost 2 years

    I installed protractor following this tutorial and when i use webdriver-manager update it says:

    selenium standalone is up to date.
    chromedriver is up to date.
    

    thou when i try to run the protractor tests, it says:

    C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:42
                throw new Error('Could not find chromedriver at ' +
                      ^
        Error: Could not find chromedriver at C:\Users\****\AppData\Roaming\npm\node_modules\protractor\selenium\chromedriver.exe
            at LocalDriverProvider.addDefaultBinaryLocs_ (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:42:15)
            at LocalDriverProvider.setupEnv (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:59:8)
            at Runner.run (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:308:31)
            at process.<anonymous> (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\runFromLauncher.js:32:14)
            at process.EventEmitter.emit (events.js:98:17)
            at handleMessage (child_process.js:318:10)
            at Pipe.channel.onread (child_process.js:345:11)
        [launcher] Runner Process Exited With Error Code: 8
    

    I checked the local.dp.js and saw that it tried to load the chromedriver from ..\node_modules\protractor\selenium\chromedriver but there only was an empty zip file called chromedriver_2.9.

    So i downloaded the chromedriver manually and copied it to this location, producing a new error:

    C:\Users\****\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1549
          throw error;
                ^
    Error: Server exited with 1
        at Error (<anonymous>)
        at ChildProcess.onServerExit (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:193:11)
        at ChildProcess.g (events.js:180:16)
        at ChildProcess.EventEmitter.emit (events.js:98:17)
        at Process.ChildProcess._handle.onexit (child_process.js:797:12)
    [launcher] Runner Process Exited With Error Code: 8
    

    Anyone any Ideas?

    • Andresch Serj
      Andresch Serj about 10 years
      i tried downloading chromedriver and putting it to the ..\node_modules\protractor\selenium\chromedriver.exe directly and it produced a new error
  • Sneh Tripathi
    Sneh Tripathi about 10 years
    Delete 0 bytes files from /selenium folder first
  • Andresch Serj
    Andresch Serj about 10 years
    Thanks. That was why the webdriver-manager update did not work.
  • Chester Rivas
    Chester Rivas about 10 years
    Also important to note I'm running protractor through Grunt, which runs with a connect task on port 9000. Hence the reason I've specified 9000 in my config.
  • pulkitsinghal
    pulkitsinghal over 9 years
    Adding this to package.json will allow npm install to take care of it: "postinstall": "echo -n $NODE_ENV | grep -v 'production' && ./node_modules/protractor/bin/webdriver-manager update || echo 'will NOT run webdriver install or update in production only'"
  • Max
    Max over 9 years
    Starting with protractor 1.0.x the default npm environment settings are used
  • Renaud
    Renaud over 9 years
    you should also set the proxy for webdriver-manager as described here
  • Andresch Serj
    Andresch Serj over 9 years
    The proxy is already defined using the --proxy=http://<your proxy server>/ Parameter as defined in the Answer given by @CleverCoder. Thanks thou.
  • bmacnaughton
    bmacnaughton about 9 years
    The zip file was always corrupted when I downloaded it. I'm not behind a proxy, so I'm not sure the problem. But I was able to get it to work with this process though running "npm run protractor" downloads chromedriver and places the executable in node_modules/chromedriver/lib/chromedriver/, so I linked it to there instead of the bin/ directory. When I did npm install chromedriver it just put a 398-byte stub in the bin/ directory.
  • Adam McCormick
    Adam McCormick almost 9 years
    This answer actually solves the problem in a sane way. Thanks!
  • Juri Sinitson
    Juri Sinitson almost 9 years
    Worked for Windows 8.1 Enterprise. Thanks a lot!
  • VSO
    VSO almost 9 years
    chromeDriver: 'C:/Users/<username>/AppData/Roaming/npm/node_modules/protra‌​ctor/selenium/chrome‌​driver.exe', This part alone did it for me. I had previously installed (npm install -g protractor) globally and I wasn't able to run a gulp task from a specific directory. Thank you Chester.
  • Micros
    Micros over 8 years
    It's a bit risky to add absolute paths when you are working with a team. For me the answer by @stitakis (running a webdriver-manager update) did the trick.
  • ebragaparah
    ebragaparah over 7 years
    for me, it was needed just to run: ./node_modules/protractor/bin/webdriver-manager update. awesome. thank you
  • Ashok kumar Ganesan
    Ashok kumar Ganesan about 4 years
    I have Chrome browser version 80 and I executed the webdriver-manager update but it thrown the error like Could not find chromedriver at I checked the node_modules/Web-driver Manager/Selenium but it does not have the relevant chrome driver version for browser version 80. Instead it had the chrome driver like 78,79 only