At this moment, there are currently 5 different built-in options for connecting to browser drivers:
- You can specify
seleniumServerJar
to start the selenium standalone server locally.
- Specify
seleniumAddress
to connect to a running selenium server (local or remote).
- Set
sauceUser
and sauceKey
to connect to Sauce Labs' remote selenium server.
- Set
browserstackUser
and browserstackKey
to use remote Selenium Servers via BrowserStack.
- Use
directConnect
to connect directly to Chrome or Firefox, with additional settings like chromeDriver
and firefoxPath
available for custom configurations.
The first 4 options primarily involve using a "proxy," which is a selenium server:
This server acts as a bridge between your test script (written with the WebDriver API) and the browser driver (controlled by the WebDriver protocols). It forwards commands from your script to the driver and returns responses from the driver to your script.
One main advantage of automating browsers through a selenium server, especially if it functions as a Selenium Grid, is the ability to scale tests across multiple browsers and systems - like in Sauce Labs Selenium Grid. Additionally, services like BrowserStack
offer similar capabilities along with various configurations for testing on different browsers and systems.
Another scenario where starting a selenium server (as in option 2) is beneficial compared to using directConnect
is when you require specific machine configurations for testing. For example, if you have Windows with IE 11 and Ubuntu with Firefox 35, configuring these machines as selenium nodes connected to a selenium server/hub would be ideal.
If running tests locally targeting Chrome and/or Firefox, opting for directConnect
will result in faster test execution. However, for testing on IE, Safari, or other non-direct connect compatible browsers, options 1-4 (usually 1) should be chosen.
Refer to the following topics for more information:
- Differences between 'Selenium-server-standalone.jar' and 'Selenium Client & WebDriver'
- Difference between "selenium server" and "selenium server standalone" jars