How To Install/Set Up Protractor

Step 1: I downloaded Visual Studio Code to use as my source code editor

 

Step 2: I downloaded Node.js

  • You can download this from the Node.js website, “https://nodejs.org/en/download/
  • In case you don’t know what Node.js is: Node.js is an open-source, cross platform JavaScript run-time environment that executes JavaScript code outside of a browser. “

 

Step 3: Create a folder on your desktop called “Project” (or whichever name you choose)

 

Step 4: Open Visual Studio Code, click on File, click on Open and double click on the folder that you created on your desktop (“Project”)

 

Step 5: A welcome message will appear on Visual Studio Code, click “New File” under “Start” heading

 

Step 6: Open your terminal in Visual Studio Code

 

Step 7: In your terminal, type “npm init” and press enter – (this creates json package)

 

Step 8: You can fill out the details it requires (package name, version, description, entry point, test command, git repository, keywords, author, licence) – you do not have to fill out everything.  After you have filled out details, it will ask “Is this OK?”, click enter to say yes.

 

Step 9: Type “npm install” – (this installs all modules listed as dependencies in json package)

  • You should see two json package files appearing under Projects (“package-lock.json” and “package.json”)

 

Step 10: Type “sudo -i”  – (sudo lets you run commands in your own user account with root privileges)

  • if you have a password for your PC, you will have to type that in and press enter

 

Step 11: Type “npm install -g protractor” and press enter – (this will install Protractor and Webdriver-Manager)

 

Step 12: Type “npm install typescript” and press enter to install TypeScript

 

Step 13: Type “webdriver-manager update” and press enter

 

Step 14: Type “webdriver-manager start” and press enter

 

You would need to do Step 13 and Step 14 every time you start your PC (to update and start webdriver). Also, don’t forget to create a .conf file and a .spec file to run your protractor tests. You use “Protractor conf.js” in your terminal to run your tests. Look at the Protractor website to see how to create and run your first test, https://www.protractortest.org/#/tutorial, this website will be very helpful as a starting point 🙂