Home  >  Blog  >   Selenium

How to Setup and Configure Selenium Webdriver with Eclipse

Rating: 4
  1. Share:
Selenium Articles

There are essentially two tasks:

  • Generate your script into a programming language from selenium-ide, optionally modifying the result.
  • Write a very simple main program that executes the generated code. Optionally, you can adopt a test engine platform like JUnit or TestNG for Java, or NUnit for .NET, if you are using one of those languages. Here, we show language-specific examples. The language-specific APIs tend to differ from one to another, so you’ll find a separate explanation for each.
  • Java
  • C#
  • Python
  • Ruby
  • Perl, PHP
Interested in mastering Selenium? Enroll now for FREE demo on Selenium Training.


For Java, we need to use either JUnit or TestNG as the test engine. Some development environments like Eclipse have direct support for these via plug-ins. This makes it even easier. You will probably want to rename the test class from “NewTest” to something of your own choosing.
Also, you will need to change the browser-open parameters in the statement
selenium = new DefaultSelenium(“localhost”, 4444, “*iehta”, “https://www.google.com/”);
The Selenium-IDE generated code will look like this. This example has comments added manually for additional clarity.
package com.example.tests;
// We specify the package of our tests
import com.thoughtworks.selenium.*;
// This is the driver’s import. You’ll use this for instantiating a
// browser and making it do what you need.
import java.util.regex.Pattern;
// Selenium-IDE add the Pattern module because it’s sometimes used for
// regex validations. You can remove the module if it’s not used in your
// script.
public class NewTest extends SeleneseTestCase {
// We create our Selenium test case
public void setUp() throws Exception {
setUp( “https://www.google.com/” , “*firefox” );

// We instantiate and start the browser
public void testNew() throws Exception {
selenium.open( “/” );
selenium.type( “q” , “selenium rc” );
selenium.click( “btnG” );
selenium.waitForPageToLoad( “30000” );
assertTrue(selenium.isTextPresent( “Results * for selenium rc” ));
// These are the real test steps

Checkout Selenium Interview Questions


The parameters required when creating the browser instance are:
Specifies the IP address of the computer where the server is located. Usually, this is the same machine as where the client is running, so in this case localhost is passed.
port Specifies the TCP/IP socket where the server is listening waiting for the client to establish a connection.
browser The browser in which you want to run the tests. This is a required parameter.
url The base url of the application under test. This is required by all the client libs and is integral information for starting up the browser-proxy-AUT communication.

Checkout Selenium Tutorial

Selenium Set up in Eclipse

This section will explain how to set up selenium in Eclipse.

MindMajix Youtube Channel

Required Software

Achala Solutions will deliver the work in four phases as listed below. Each of the phases and activities are described in the following picture

  • Eclipse (Version 3.5.2) –


  • Jdk 1.5.0_11 or above


  • 4 Jar files (junit-4.5, jxl, selenium-java-client-driver, seleniumserver)

Related Page: How To Create Test Suites In Selenium


1. Create an empty folder (Selenium_Scripts1) in F drive-no need to create in F drive you can create folder in any folder.
2. Create an empty folder lib in Selenium_Scripts1 folder.
3. Install jdk1.5.0_11, copy the jdk1.5.0_11 folder which is in c folder
(Generally it will be installed in “C” Drive– C:Program FilesJava) and paste it in Selenium_Scripts1 folder.
4. Paste the 4 Jar files (junit-4.5, jxl, selenium-java-client-driver, and seleniumserver) in lib folder.
5. Open eclipse (F: eclipseeslipse.exe)
You will get the below window, select the path (F: Selenium_Scripts1) which you created a folder earlier in F drive.

Workspace Launcher

After clicking OK, you will get below screen select “work bench”.

You will get the below screen—eclipse environment.

Eclipse environment

Explore Selenium Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Create Java Project

1. File—New—Java Project
2. Give Project name (Selenium_scripts)
3. Click Configure JREs in that screen. You will get a new window.
4. Click Add—Standard VM????next.
JRE Home—we need to specify path.
Click directory—browse the path where you created the folder
All jar files will be added.. click Finish and click OK
Click finish on the open window (New Java Project window)
You can see the new project Selenium_scripts in eclipse window.
New Java Project with all jar files.

Java-Eclipse SDK

Now Right click on JRE System Library[Java SE-1.6]
Select Build Path- configure Build Path.
A new window will be opened. Select Libraries tab and click Add External Jars Button.
Select path F:demolib and select all 4 Jar files click OK.
You can see all Jar files under Libraries Tab.
Click Ok.
You can see the Referenced Libraries…

Text view & Edit view

Everything is done.

Now need to create selenium server…

Go to RUN     External Tools     External tools configuration…
There click Program—u will get new configuration window.
Give name selenium server (any name you can give).
Location —click on Browse file systems. F:Selenium_Scripts1jdk1.5.0_11binjava.exe
Working Directory— Browse file system — F: Selenium_Scripts1lib.
Arguments –     -jar selenium-server.jar
Click Apply and Run….

Related Page: Automation Selenium RC Using TestNG - Selenium

Your selenium server will be up and running….

Selenium server will be up and running

Now, you can write your scripts and Enjoy Selenium Automation….

Create Class

File – New –class
Give Name First and click the check box public static void main (String [] args) click Finish.



Join our newsletter

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
Selenium Training Apr 27 to May 12View Details
Selenium Training Apr 30 to May 15View Details
Selenium Training May 04 to May 19View Details
Selenium Training May 07 to May 22View Details
Last updated: 04 Apr 2023
About Author


Madhuri is a Senior Content Creator at MindMajix. She has written about a range of different topics on various technologies, which include, Splunk, Tensorflow, Selenium, and CEH. She spends most of her time researching on technology, and startups. Connect with her via LinkedIn and Twitter .

read more
Recommended Courses

1 / 15