Luckily for us, we don't have to remember all the basic configurations for Protractor. Within npm_modules
, there are examples that we can use. Here are the steps to copy the Selenium standalone configuration:
Open up the example Protractor configuration file that is located in the following directory:
./node_modules/protractor/example/conf.js
Copy the file to your local test folder:
$ cp ./node_modules/protractor/example/conf.js
The configuration should look very similar to the chromeOnly
configuration. Here is a snippet of the important configuration items:
exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome' }, … };
The first important item is the seleniumAddress
object. The address is the hostname, port, and location where the Selenium Server is running. The next important item is the capabilities
object. Browser-specific capabilities give you the ability to define which browsers will be tested against. As we are not using the ChromeOnly
configuration, you can now choose Internet Explorer (IE), Firefox, and so on. For more information on multiple browser support and capabilities, refer to the Protractor documentation at https://github.com/angular/protractor/blob/master/docs/browser-setup.md
In the next section, we will look at how to run Selenium.
Tip
The seleniumAddress
object is meant to be configurable so that you can have a separate instance in a completely different location than your development machine. Visit the Selenium site for more information at http://www.seleniumhq.org/.