To set up protractor, we need to install below three things
- Selenium Webdriver
Step 1: Install NodeJS, click here to download node.js
Click on Windows Installer. Once the download has finished. 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, check from the command prompt by typing the command ‘npm -version‘ in command prompt which will give you the installed version.
Note: Restart the machine after installing NodeJS
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: Create a directory, “Protractor” and navigate to that folder and type the command npm install protractor
To install globally, please go ahead and type the command npm install -g protractor in command prompt. This command will install protractor and make it available globally.
Once that is done, confirm by typing ‘protractor –version’ in the command prompt which will show you the protractor version that is installed.
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.
To start webdriver: type the command ‘webdriver-manager start’ in command prompt.
- Login to the machine where you have installed Protractor
- Open command prompt and start selenium server Webdriver-manager start
- Open another command prompt and move to the below location cd C:Users<USER> AppDataRoamingnpmnode_modulesprotractorexample
- Now run : protractor conf.js command to start the test
- If you want to run particular test case. Go to C:UsersUser>AppDataRoamingnpmnode_modulesprotractorexample
And edit the “conf.js” file. In this file add your test script file name to “specs:” section
- Your test case html report and screenshots will be under c:/temp/report folder
- If you get any error as “Error: ENOENT, stat ‘C:Users<name>AppDataRoamingnpm.”. 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<USER>AppDataRoamingnpm
- You will have proxy issues if you try to install in office.
Open IE -> Settings -> Internet options -> Connections -> LAN settings -> Under Proxy server select
“Proxy server” -> Advanced
Here set proxy address: