June 19, 2017
Local Selenium Setup: Text Version
Before you can start running Selenium tests it is necessary to setup a few things so Selenium can correctly control the browsers. This lesson covers installing everything on your local development environment. See the Selenium Grid lesson if you want to setup a distributed test system for integration with a CI environment.
Installing Required Software
The Selenium Framework is based on the Java programming language so you will need to have Java Installed on your machine. Please download and install the Java version that matches your operating system here:
Installing Necessary WebDrivers
To control the different browsers you will need a so-called Webdriver for each browser you want to control. The installation is slightly different depending on your operating system.
It is recommended to place all Webdriver executables in one folder to minimize the effort to get everything working.
On Windows, you will need to add the folder with all your Webdrivers to the Path environment variable (How to).
On macO, you will also need to add the folder with your webdriver to the Path. You can do so with the below commands:
- Open a new terminal window
- Run ‘sudo nano /etc/paths’
- At the bottom of the file add the path of your Selenium folder
- Press Control-X to quit
- Press Y to save
- Relauch the terminal
On Linux, you can add the folder to the path (How to).
Google Chrome
You can download the Webdriver for Google Chrome here. Simply place the executable in your Webdriver folder mentioned above.
Mozilla Firefox
For Firefox 48 or higher, you need the Geckodriver created by Mozilla. You can download the executable here. Place it in your Webdriver folder. Older Firefox versions don’t need a separate Webdriver to work.
Internet Explorer
The Webdriver for Internet Explorer can be found on the Selenium homepage (32bit version / 64bit version). Obviously, you can only run Internet Explorer on Windows.
Microsoft Edge
For the new browser by Microsoft, a Webdriver is available as well. Make sure to pick the right one depending on the installed version of Edge here. You can simply download and run the setup. Again this one only works on Microsoft Windows.
Apple Safari
To enable Safari support for Selenium please follow this steps:
- Ensure that the Develop menu is available. It can be turned on by opening Safari preferences (Safari > Preferences in the menu bar), going to the Advanced tab, and ensuring that the Show Develop menu in menu bar checkbox is checked.
- Enable Remote Automation in the Develop menu. This is toggled via Develop > Allow Remote Automation in the menu bar.
- Authorize safaridriver to launch the webdriverd service which hosts the local web server. To permit this, run ‘/usr/bin/safaridriver’ once manually and complete the authentication prompt.
Of course Safari can only be used on macOS.
Next Steps
Now that you have setup your local Selenium environment you can move on to setup your development environment and get ready to create your first Selenium test. The development setup depends slightly on your programming language so pick the lesson of your choice: