-
Notifications
You must be signed in to change notification settings - Fork 0
09 Browser Setup
Biswajit Sundara edited this page Feb 25, 2021
·
4 revisions
Protractor recommends two browsers chrome & firefox. However we can also test using internet explorer.
In selenium we download the webdrivers and set the path, here in protractor the drivers are downloaded when we execute webdriver-manager update command. The location of the files depend on how we have installed protractor.
- If we have installed globally then it will be available under
AppData/Roaming/npm/node_modules - If we have setup at project level then
\node_modules\protractor\node_modules\webdriver-manager\selenium - By default the internet explorer driver is not available as protractor doesn't recommend it.
- If we want to test for IE then use the command
webdriver-manager update --ie - Check the driver location and you should see IE drivers.
The default browser is chrome.
add this in conf.js file
capabilities:{
'browserName': 'firefox'
}
capabilities:{
'browserName': 'internet explorer'
}
No need to set anything as chrome is the default browser however if we want to apply headless option etc.
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
}
}
Protractor can directly test in chrome/firefox without using selenium server. Use directConnect: true in conf.js file.
- Only chrome and firefox browser can be used with this option, for other browsers it will error out
- The main reason for using this option is
speed - Running the tests using selenium server allows us to run in remote machines using the ip address and port numbers also in different browser/browser versions.
- Where as
directConnect: truewill run tests only on the local installation of FireFox and Chrome. It will run the test on the same machine where test codebase exist. - Best practice is to use selenium server
Reference
https://www.protractortest.org/#/browser-setup
https://www.protractortest.org/#/server-setup