Unable to use Protractor webdriver-manager

All we need is an easy explanation of the problem, so here it is.

I am trying to start protractor on my local Windows development machine. In an attempt to do so, I am trying to start it from the command-line using the following command:

C:\myProject\node_modules\grunt-protractor-runner\node_modules\protractor\bin>webdriver-manager start

When that command is run, I get an error that says:

'webdriver-manager' is not recognized as an internal or external command,
operable program or batch file.

I was confident this was correct though. I’m installing protractor via NPM. My package.json file looks like this:

{
  "name": "MyProject",
  "version": "0.0.1",
  "description": "Just the description",
  "repository": "N/A",
  "readme":"N/A",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "devDependencies": {
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-concat": "0.4.0",
    "grunt-contrib-connect": "0.7.1",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-cssmin": "~0.6.1",
    "grunt-contrib-htmlmin": "~0.1.3",   
    "grunt-contrib-jshint": "0.9.2",
    "grunt-contrib-uglify": "~0.2.4",
    "grunt-contrib-watch": "0.5.x",
    "grunt-protractor-runner": "0.2.4",
    "grunt-start-webdriver":"0.0.2",
    "phantomjs": "1.9.7-3",
    "selenium-webdriver":"2.41.0",
    "load-grunt-tasks": "0.2.x",
  },
  "license": "none"
}

What am I doing wrong? Why can’t I get protractor to run? Thank you!

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Install protractor globally.

npm install protractor -g

This will install protractor and webdriver-manager.
Then run from the command line: webdriver-manager update
Check for more info on: http://angular.github.io/protractor/#/tutorial

Method 2

webdriver-manager is actually a NodeJS script. Run it using

node webdriver-manager start

Method 3

Try installing it globally as an Administrator:

npm install -g webdriver-manager

Method 4

If you are a Windows user, this could help you:

  1. Add C:\Users\%username%\AppData\Roaming\npm to the PATH variable.

  2. Close cmd/powershell and open it again.

  3. Try webdriver-manager

Method 5

use grunt-protractor-webdriver, you also need protractor in your package.json if you don`t installed it as global (-g)

add this to your package.json under "devDependencies":

    "protractor": "^2.1.0",
    "grunt-protractor-webdriver": "^0.2.0",

also look at grunt-protractor-runner it can start protractor from a grunt process without starting the selenium server ( webdriver-manager start )

to start the selenium server with grunt-protractor-webdriver add this to your Gruntfile

    protractor_webdriver: {
        options: {
          keepAlive: true
        }
    }

and add it to a grunt-task

    grunt.registerTask('start-selenium-server', ['protractor_webdriver']);

Method 6

Deprecated version of node – it was problem on my pc.

Just updated it downloading last version from https://nodejs.org/en/ and all works.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply