Reputation: 1565
I'm trying to install Protractor globally and download Selenium binaries by executing following commands.
npm install -g protractor
webdriver-manager update
webdriver-manager update --ie
When I execute them directly from CMD or Powershell console, they works properly. Unfortunately, when I try to execute them from Jenkins (on exactly the same machine), only the first command is executed properly. Next one gives an error:
'webdriver-manager' is not recognized as an internal or external command, operable program or batch file.
It doesn't matter whether I execute those command from 'execute windows batch command' step nor 'Windows Powershell'
Does it mean that path
variable is not updated when installing Protractor?
Upvotes: 1
Views: 10614
Reputation: 13712
You need to append the npm global package install folder to the PATH
environment. Considering you run script by Jenkins, it's not recommend modify the PATH
environment on Jenkins slave machine.
1) The better way is to use local protractor
and webdriver-manager
of your project.
You should add protractor
into your project's package.json
as a dependency. Then execute npm install
by Window Batch Command
to install all dependencies.
After that, you can get protractor
and webdriver-manager
from <project folder>/node_modules/.bin/protractor
and <project folder>/node_modules/.bin/webdriver-manager
respectively.
So your Window Batch Command
should be like:
npm install
./node_modules/.bin/webdriver-manager update --proxy <your proxy>
./node_modules/.bin/webdriver-manager update --ie --proxy <your proxy>
Make sure the npm install
executed under folder where the package.json
inside.
If you don't know how to do that, update your project folder structure in screenshot in your question.
2) If you prefer to modify the PATH
environment dynamically, your Window Batch Command should be like:
npm config get prefix > prefix
set /P prefix=<prefix
set PATH=%prefix%;%PATH%
npm install -g protractor
webdriver-manager version
webdriver-manager update --proxy <your proxy>
webdriver-manager update --ie --proxy <your proxy>
Upvotes: 1