Protractor is an end-to-end test framework developed for Angular and AngularJS applications. It runs tests against the application interacting with it as a real user would, running in a real browser.
- Tests using browser: Protractor uses native events and browser-specific drivers to interact with the application.
- Build for Angular: Protractor is built for Angular and thus the support is amazing.
- Automatic Waiting: You no longer need to add waits and sleeps to your test. Protractor automatically executes the next step in your test the moment the webpage finishes pending tasks, so you don’t have to be waiting for your test and webpage to sync.
1. Protractor can be installed globally over NodeJS using the command given below:
// For Windows npm install -g protractor // For Linux sudo npm install -g protractor
Note: For users in Ubuntu, you need to add sudo to all the given commands for permission.
2. Now to check if the installation was successful let’s check the version of the protractor using the command given below:
3. The above screenshot says the version is 7.0.0 which means the installation was successful.
Setup: Now we have two commands available to us after the installation which are protractor and webdriver-manager. The webdriver-manager is a helper tool to easily get an instance of a Selenium Server running. There are two steps to be followed now:
4. Updating the binaries: We can update the necessary binaries using the below command.
// For Windows webdriver-manager update // For Linux sudo webdriver-manager update
5. Starting the server: After this, we can run Selenium Server using the below command.
// For Windows webdriver-manager start // For Linux sudo webdriver-manager start
6. After this, you can access the server at http://localhost:4444/wd/hub.