Let’s quickly go over a few basics. What is Selenium?
Selenium is an open source, cross-operating system, cross-browser, cross-platform tool for automating actions carried out on the web browsers. It’s used for automated testing but it can also be used for automating actions on the browser other than testing.
- Tests/Actions can be carried out in any operating system: Windows, Mac or Unix
- Tests can be carried out using any browser: Mozilla Firefox, Internet Explorer, Google Chrome, Safari or Opera
- It can be integrated with tools such as TestNG & JUnit for managing test cases and generating reports
- It can be integrated with Maven, Jenkins & Docker to achieve Continuous Testing
To develop automated tests using Selenium first, you need to prepare the necessary infrastructure.
The key elements of this infrastructure are determined by how the selenium tool is integrated with browsers.
First, you need to have browsers installed, Selenium does not contain browsers, it uses browsers that are already installed on the system. Chrome, Firefox, Internet Explorer most common browsers that we are going to use in this documentation.
Secondly, for each browser you need an additional auxiliary executable file, for Chrome – chromedriver, for Firefox geckodriver, for Internet Explorer – IEDriverServer and so on.
It is useful to download all the drivers and put them in a separate folder for ease of access. For example, C:\Tools
Download browser drivers on Selenium HQ website at https://www.seleniumhq.org/download/
Language-specific Client Libraries
Thirdly, in order to create tests in a specific programming language, we need a client library for that language that will connect to auxiliary executable files and control the browser through them. Each programming language has its own client library.
In this tutorial, we will be creating scripts using C#, Java, and Python. Language-specific libraries for these languages can be downloaded at https://www.seleniumhq.org/download/
Please see tutorials for each language which will provide details regarding the installation of Language-specific libraries.
NOTE: Each programming language, usually has a standard package repository to distribute libraries, and client libraries for Selenium are distributed through these standard package repositories.
For example, in Visual Studio, C# Selenium libraries are distributed through NuGet Package Manager.
Interpreter or compiler for your language.
- Install .NET for C# (Installing Visual Studio should take care for installing all the necessary files)
- Install Python
Integrated Development Environment (IDE)
- Visual Studio for C#
Language compiler and dependencies manager
The Test Framework will allow test execution and result generation.