To set up protractor, we need to install below three things
1. Node.js
2. Protractor
3. Selenium Webdriver
Step 1: First we have to install NodeJS. Please click here to download node.js
What is Node.js ???
Node.js is an open source, cross-platform runtime environment for server-side and networking applications. Click here for details on Node.JS
Click on Windows Installer ( as im using windows, i have choosen to download windows installer). Once the download has finished. Please double click on exe file and Click on Run button.
It will launch Node.js setup wizard. Click on Next and click ok next button by accepting the terms and conditions and proceed to installation.
Now to see if the installation is done successfully, you can go and check in system environment variables. The path will be defined automatically.
You can also check from the command prompt by typing the command 'npm -version' in command prompt which you give you the installed version
Step 2:
Installing protractor can be done in two ways Locally and Globally
We can Install protractor in a specified folder or project directory location. If we install in a project directory, every time we run, we should run from that location only.
To install project directory, navigate to that folder and type the command npm install protractor
To install globally, please go ahead an type the command npm install -g protractor in command prompt.
The above command will install protractor and make it available globally.
If you get any error as "Error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm.". Please create a folder named 'npm' which will solve your problem.
And also make sure you navigate to the folder AppData/Roaming/npm and install protractor
Path may look like C:\Users\name\AppData\Roaming\npm
Note: if you are not able to view the AppData folder, request you to view the hidden folders.
Once that is done, confirm by typing 'protractor --version' in the commend prompt which will show you the protractor version that is installed.
Step 3:
To update the selenium webdriver, please type the command 'webdriver-manager update' in command prompt
It will download all webdriver latest version and default chrome driver.
Now installation part is done successfully.
Let us now try to run one basic example using protractor.
Comments
Good Tutorial
Kindly add a step : Please remember to restart the machine after installing Node.js.
My errors got resolved after restart.
Otherwise, really great tutorial. Thanks a lot
After Restart
Yes. My Errors also got resolved after restart.
Not able to execute file
I have installed Protractor using above step. But still I am unable to execute the scrip.
It trows exception when I try to access conf file.
Error??
Could you please let us know the exception that you are getting.???
pls help resolving error
C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:126
throw e;
^
Error: Spec patterns did not match any files.
at Runner.run (C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:269:11)
at TaskRunner.run (C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\lib\taskRunner.js:123:19)
at createNextTaskRunner (C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\lib\launcher.js:216:20)
at C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\lib\launcher.js:239:7
at _fulfilled (C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
at C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:573:44
at flush (C:\Users\RK\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:108:17)
at doNTCallback0 (node.js:430:9)
Where can i write the program
Where can i write the program using protractor?
Do i need to configure any jar files in selenium webdriver?
Please help me i'm new to this. Thanks in advance.
Error in installation - Can you help me to install protractor?
C:\Users\U0136365\AppData\Roaming\npm\node_modules\protractor\node_modules\buffe
rutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_mod
ules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
) else (node rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:71:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\U0136365\AppData\Roaming\npm\node_modules\protractor\node_
modules\bufferutil
gyp ERR! node -v v5.3.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1
> utf-8-validate@1.2.1 install C:\Users\U0136365\AppData\Roaming\npm\node_module
s\protractor\node_modules\utf-8-validate
> node-gyp rebuild
protractor installation
I am getting python var not defined error; i dont know why it is asking for python!
You can ignore this error.
You can ignore this error. The installation should still be right to start
install protractor giving error
Giving error please help me
C:\>npm -version
3.3.12
C:\>npm install -g protractor
npm WARN deprecated lodash@2.4.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0
C:\Users\acer1\AppData\Roaming\npm\protractor -> C:\Users\acer1\AppData\Roaming\npm\node_modules\protractor\bin\protractor
C:\Users\acer1\AppData\Roaming\npm\webdriver-manager -> C:\Users\acer1\AppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
> bufferutil@1.2.1 install C:\Users\acer1\AppData\Roaming\npm\node_modules\protractor\node_modules\bufferutil
> node-gyp rebuild
C:\Users\acer1\AppData\Roaming\npm\node_modules\protractor\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\acer1\AppData\Roaming\npm\node_modules\protractor\node_modules\bufferutil
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1
> utf-8-validate@1.2.1 install C:\Users\acer1\AppData\Roaming\npm\node_modules\protractor\node_modules\utf-8-validate
> node-gyp rebuild
Add new comment