Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 537
Andresch Serj Avatar asked Mar 05 '14 09:03

Andresch Serj


People also ask

How do I install Chrome protractor driver?

To install and start the standalone Selenium Server manually, use the webdriver-manager command line tool, which comes with Protractor. Run the update command: webdriver-manager update This will install the server and ChromeDriver. Run the start command: webdriver-manager start This will start the server.

How do I find ChromeDriver in Windows?

Go to the terminal and type the command: sudo nano /etc/paths. Enter the password. At the bottom of the file, add the path of your ChromeDriver. Type Y to save.


1 Answers

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...

like image 115
stitakis Avatar answered Sep 28 '22 08:09

stitakis