Terasol's Insights to Innovative Software Development Services

Selenium Framework: Installation Guide for Windows

Written by Pulak Sharma | Apr 20, 2022 10:43:22 AM

With the increasing demand from customers from custom mobile app development services for the most recent versions of web apps, developers have been forced to push themselves to release upgrades every few weeks.

It resulted in rising reliance on automation to help shorten the software development cycle, both in terms of coding and testing.

Automation has become an integral part of the software development industry. Many frameworks have been developed that allow users to improve their workflow by automating repetitive tasks with a few lines of code.

Teams have been able to ship new features with fewer bugs and at a much faster rate thanks to automation testing. This then helps in maintaining strong client involvement and keeping off the competition.

Selenium is one such tool that allows you to run automated tests on web applications. One notable component of the complete Selenium package is the Selenium WebDriver.

In this blog, we will see what is selenium and a guide to installing selenium for windows.

Let’s get started!

What Is Selenium Framework?

Selenium framework is an open-source test automation framework that is mainly used to test web applications across different browsers and platforms. The framework is available for a number of programming languages including Java, C#, Python, JavaScript, Ruby, Kotlin, etc.

 đźŹ˘ It is commonly utilized for testing by major corporations such as Google, Netflix, Fitbit, and others, as well as new companies.

 

Such frameworks provide advantages such as enhanced code reusability, higher portability, lower script maintenance costs, better code readability, and so on.

There are various components of the Selenium framework:

  • Selenium IDE (Integrated Development Environment)
  • Selenium Remote Control
  • Selenium WebDriver
  • Selenium Grid

All of these components have certain features associated with them. But in general, the entire Selenium framework helps in automated testing of web applications. Apart from web testing, you can also develop web crawlers using Selenium WebDriver.

Selenium Framework: Installation

Installing Selenium WebDriver

To install Selenium WebDriver, one of the supported languages must be installed on your computer. Here we will cover selenium using Java.

For Windows

First you need to install Java on your system. Go to the official website of java and follow the required steps. The link is provided below.

Link: https://www.java.com/download/ie_manual.jsp

Click on Agree and Start free download to download the required files. Next, double-click on the downloaded file and click on install. This will install both the JDK and JRE in your system.

Note: Save the address of the folder where all the java files are installed

Adding Java path variable in windows.

  1. If you’re on Windows 10, right-click on the This PC icon and select properties. Or go to This PC right-click on it and then select properties.
  2. Click on Advanced System Settings available on the left section of the window.
  3. On the advanced tab click on environment variables.
  4. Here in the system variable section double click on the path.
  5. Now we need to add the Java folder path which we saved earlier. Click on new and paste the address.
  6. Click Ok to save your settings.

Note: To ensure Java is added to your system path. Open Command prompt as administrator and type the given command: java -version. If the system shows the version, then java is successfully installed in your system.

Installing Eclipse IDE

Although Selenium framework Web Driver can be run in various IDE like NetBeans, and Visual Studio, however here in our case we’re using eclipse to run selenium code.

  1. Go to the official webpage of the eclipse: https://www.eclipse.org/
  2. Click on the Download button present in the navigation menu.
  3. Click on the download packages option for the available eclipse packages.
  4. Search for the package Eclipse IDE for Java Developers on the list and click on the windows version(This may vary as per your operating system).
  5. On the next page click on the download button to get the eclipse zip installation files.
  6. Unzip the file and install eclipse IDE.

Note: In some cases, we also need to set the path of the eclipse folder. For being on the safer side copy the address of the eclipse installed folder and paste it into the environment variables.

Configure Selenium in Eclipse

In order to successfully run selenium scripts, the code should interact with the selenium server. For this users and software development companies need to add various jar files in eclipse. Follow the following steps to download all the necessary jar files in your system.

  1. Go to the official page of selenium: https://www.selenium.dev/downloads/
  2. In our case, we’re running the scripts using Java, thus on the Selenium Clients and WebDriver Language Bindings section click on the stable version under java to download all the necessary files.
  3. Extract the zip files in your system.

Adding jar files to eclipse

  1. Open eclipse ide for java developers
  2. Go to File and select new.
  3. Click on Java Project.
  4. In the pop-up window provide a name to your project as per your requirement. Rest keep all the settings to default and click on next.
  5. On the next page, you will be provided with the address of the default output folder for the project files. If you want you can change the folder address, if not simply click on Finish.
  6. In the next window, you will be prompted if you want to create a module for the same project. Click on the Don’t create button here, as this is not a mandatory step.
  7. A new project will be added in the project explorer section with the name you have given.
  8. Right-click on the project and select Build Path > Configure Build Path.
  9. In the next window first, verify that you’re in the libraries section, then click on the classpath. This will add the external jars to the classpath folder.
  10. Now click on Add External Jars.
  11. Select all the Jar Files to add the files to the current project and click on open
  12. Next click on apply and close.

How to set up Selenium WebDriver with Java

To use Selenium framework's WebDriver for web automation, you will need to download a driver that integrates with your browser of choice. This driver will allow Selenium to control the browser and automate the commands you write in your scripts.

Selenium framework currently supports Google Chrome, Firefox, Microsoft Edge, Opera and Safari. The official web driver for Chrome is ChromeDriver and Geckodriver is the official web driver for Firefox.

Links to download the required drivers is given below.

Google Chrome:

https://chromedriver.chromium.org/downloads

Firefox:

https://github.com/mozilla/geckodriver/releases

Microsoft Edge:

https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

Safari: https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari

Code: WebDriver driver = new ChromeDriver();

System.setProperty(“Webdriver.chrome.driver”, “address of the chromedriver in your local system”);

Note: You must ensure that the web driver and the browser version should be the same to run the scripts successfully.

Closing Note:

Automation testing with Selenium framework appears to be the ideal option given the demands of rapid and reliable testing that spans several browsers and devices to ensure compatibility.

Selenium Framework is widely used in the industry because it provides greater feasibility, flexibility, and cost-effectiveness than other testing frameworks. As a result, it's an excellent way to provide a consistent end-user experience that adheres to the continuous delivery methodology.

Our software development company provides a variety of testing types, including data-driven testing and keyword-driven testing while developing web apps. Reach out to our experts to know more about developing and testing apps.