In this section:
Selenium WebDriver is a framework that facilitates web application automation. It makes direct calls to the browsers installed on the machine using the browsers' native driver. Each major browser provides its own implementation of the WebDriver interface (usually referred to as a "WebDriver," too). The appropriate WebDriver is required for each browser your Selenium tests are written to execute. Refer to the System Requirements for a list of supported browsers and drivers.
Be sure to download the correct WebDriver for your browser version.
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
Extract the executables from the downloaded files to your machine.
Configuring the WebDriver preferences enables you to execute run configurations in your IDE.
Specify the path to the appropriate WebDriver for the browser version in each field. Only the WebDrivers for the browsers you intend to test with need to be provided. Each operating system supports different browsers. The following screenshots show the WebDriver configuration screen for Windows and macOS to illustrate.
Microsoft Edge and Apple Safari are native OS browsers. The OSes already include Microsoft WebDriver (for the latest versions of Windows and Edge) and SafariDriver, respectively.
If you are using the command line to run Selenic, you need to include an argument to call the WebDriver in each command for every browser you are testing, e.g.:
mvn test -DargLine=-javaagent:/path/to/selenic_agent.jar -Dwebdriver.chrome.driver=/path/to/chromedriver |
See Usage for details.
You can add the location of the WebDriver to the PATH system variable so that you do not need to include the path to the WebDriver in each command.
The easiest way to add the WebDriver to your PATH is to use a package manager, such as Chocolaty for Windows or brew for MacOS, e.g.:
choco install chromedriver |
brew cask install chromedriver |
The package manager will copy the WebDriver executable to a directory on the PATH.
If you do not have a package manager installed, you can manually add the WebDrivers to the PATH.
The following instructions describe how to add the executable to the PATH using Windows 10. Refer to the documentation for your version if you are on a different version of Windows.
;
) and specify the directory containing the WebDriver executable.Open Terminal and open /etc/paths in an editor as an administrator, e.g.:
sudo vim /etc/paths |