DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL
  • Simplify NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3

Trending

  • Optimizing High-Volume REST APIs Using Redis Caching and Spring Boot (With Load Testing Code)
  • AI Agents in Java: Architecting Intelligent Health Data Systems
  • Docker Hardened Images Are Free Now — Here's What You Still Need to Build
  • DevOps and Platform Engineering Readiness Checklist: Everything Needed for a Scalable, Secure, High-Velocity Delivery Platform
  1. DZone
  2. Coding
  3. Frameworks
  4. How to Configure Selenium in Eclipse

How to Configure Selenium in Eclipse

This article discusses how to configure Selenium in Eclipse to use Selenium for Java.

By 
Garima Tiwari user avatar
Garima Tiwari
·
Mar. 11, 22 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
4.3K Views

Join the DZone community and get the full member experience.

Join For Free

Managing user experience is pivotal for software development. Test automation enables user preferences and convenience to remain at the center of the development process while saving time and effort. That is why comprehensive automation testing has become necessary to retain customers and meet their expectations. With significantly shorter time frames for development, Selenium Testing, in particular, has become an integral part of the development to facilitate automated testing of web applications. 

Selenium is the most popular automated tool in existence today. 59.5% of people consider Selenium for Cross Browser Testing because of the robustness and flexibility it offers by supporting multiple languages like Java, C#, Python, Perl, Ruby, etc. However, a majority (67%) of the Selenium users prefer Java as their language for Selenium Testing.

This article discusses how to configure Selenium in Eclipse to use Selenium for Java.

Prerequisites for Configuring Selenium in Eclipse

  • Install Java

Download Java SE Development Kit 16.0.2 according to the Windows, Linux, or macOS platform being used.

Java SE Development Kit 16.0.2

Source


Run the JDK Installer by double-clicking on the file name in the download location and following the instructions on the instruction wizard. Alternatively, silently install JDK by entering the following command:

 
jdk.exe /s


  • Install Eclipse IDE

Install Eclipse IDE

Source


  • Install Selenium

Download and Install Selenium to be set up in Eclipse.

  • Install Browser Driver

For cross-browser testing, download the relevant Browser Driver – ChromeDriver (for Chrome), GeckoDriver (for Firefox), SafariDriver (for Safari), and InternetExplorerDriver and MSEdgeDriver (IE and Edge respectively). Place these browser driver files in a directory that is part of the environment PATH. This will allow a command-line call to the programs to execute them irrespective of the working directory.

  • Install Java Language Bindings

    • Version 3.141.59 (2018)
    • Changelog
    • API Docs 

Java Language Bindings

Source


How to Configure Selenium in Eclipse

Here are the steps to configure Selenium Webdriver with Eclipse:

Step 1: Launch Eclipse

To launch Eclipse double click on the eclipse.exe file in the download location.

Step 2: Create Workspace in Eclipse

This workspace named “C:\BrowserStack” is like any other folder, which will store all the test scripts. Launch the BrowserStack workspace.


Creating Workspace in Eclipse

Creating Workspace in Eclipse


Step 3: Create New Java Project in the BrowserStack Workspace

Create a new Java Project by clicking on File > New > Java Project and name it.

Creating a new Java Project

Creating a new Java Project


Step 4: Create Package and Class Under the Java Project
 

By clicking on the src folder (which is the source folder), create a new package and name it (BrowserStack). Then right-click on the package name and create a class. 

Creating Class in Package

Creating Class in Package


Step 5: Add Selenium JARs to the Java Project in Eclipse

To add the Selenium Jars to the BrowserStack Java right click on the BrowserStack Project folder and select the Properties option. In the properties window, click on the Java Build Path and Add External JARs. Browse and add the downloaded Selenium JARs i.e. Client Combined JAR and all the JARs under the Libs folder, then click Apply and Close.

Adding Selenium JARs in the Project

Adding Selenium JARs in the Project


This configures Selenium with Eclipse, making it ready to execute the first Selenium test script in Java.

In a Nutshell

Automation testing using Selenium with Java has simplified software development. Being an open-source tool, it provides an opportunity to speed up the time of execution and remove errors for a better user experience. 

Java is quite popular among the developers, given the extensive support being available, making it a preferred choice as a Selenium Client Language Binding. Selenium with Java has proved helpful in optimizing regression testing and cross-browser testing. With the support of continuous integration tools like Jenkins, Selenium with Java can be used in continuous delivery models. 

However, to make testing more efficient and get accurate results every time, all Selenium tests must be run on real browsers and devices for accurate results as a best practice.

Eclipse Java (programming language)

Published at DZone with permission of Garima Tiwari. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL
  • Simplify NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook