Close Menu
TechBeamersTechBeamers
    TechBeamersTechBeamers
    • Python
    • Java
    • C
    • SQL
    • MySQL
    • Selenium
    • Testing
    • Agile
    • Linux
    • WebDev
    • Technology
    TechBeamersTechBeamers
    Selenium Tutorial

    Six Steps To Setup Selenium WebDriver Project in Eclipse

    By Meenakshi AgarwalUpdated:Nov 05, 20233 Comments6 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    In this post, we will describe the easiest way to create a setup of the Selenium Webdriver project using the Eclipse IDE.

    Must Read – Create Selenium 3 Project with Java

    We’ve covered the whole process in six main steps, starting from the required Software downloads for creating the Test Project.

    If you follow this tutorial correctly, then it will be quite easy to write your first Selenium Test Script.

    Let’s first get aware of the prerequisites to start our work.

    Pre-requisite

    Steps to Download and Install Eclipse IDE

    1. Before the start, please check if you have the Eclipse IDE installed on your system. If it’s not there on your machine, then please install it from its website.
    2. For your note, there are different versions of Eclipse available like the Windows-32/64 bit, Linux, and Mac OS X operating systems. Hence, download the latest version of Eclipse that suits your system configuration.
    3. After the completion of the previous step, locate and start the “eclipse.exe” from the folder where you saved the Eclipse binary. And define a path for the “Workspace,” which you’ll be using to set up the Selenium Webdriver project.

    In the subsequent sections, we will outline the necessary steps to set up the Selenium Webdriver project. Please follow them one by one.

    Your First Selenium WebDriver Project in Eclipse

    We’ve given the bare minimum steps required to set up a Selenium Webdriver project from scratch. Follow Eclipse IDE images for proper guidance.

    Step#1: Add a New Java Project in Eclipse IDE

    Open Eclipse IDE, as described in the above steps, and select “Java Project” from the list of project types to create a new module.

    See also  How to Select the Selenium Locators

    This project will get automatically saved to the Workspace that you would have specified previously.

    Setup Selenium WebDriver Project-1
    Setup Selenium WebDriver Project-1

    Step#2: Enter the name of the project Eg-WebdriverDemoProject

    Settings-2
    Setup Selenium WebDriver Project-2

    Step#3: Create a New Package

    Right-click on the newly created project as a New-> Package.

    Settings-3
    Setup Selenium WebDriver Project-3

    Give the name of the package, e.g. “<samplePackage>” and click on Finish

    Settings-4
    Setup Selenium WebDriver Project-4

    Step#4: Create a New Java Class

    Right-click on the newly created package to create a Java class as New->Class.

    Setup Selenium WebDriver Project-5
    Setup Selenium WebDriver Project-5

    Give the name of the class file, e.g., –WebdriverDemo.

    Select the checkbox for “public static void main (String[] args)” and click on Finish.

    Setup Selenium WebDriver Project-6
    Setup Selenium WebDriver Project-6

    The newly created Java class file looks like this after successful creation.

    Settings-7
    Setup Selenium WebDriver Project-7

    Step#5: Download the required jar files

    Before we can proceed with writing test scripts, we have to download the following jars to let Selenium test scripts execute.

    Download Selenium Webdriver jars (highlighted in red) from the Selenium HQ Website, extract them, and place them in the “Jar Files” folder of “WebdriverDemoProject.”.

    Settings-8
    Setup Selenium WebDriver Project-8

    Download Apache POI API Jar Files.

    1- It’s a favorite Java API of automation testers as it helps them read, write, and create Microsoft Excel files. It also supports other file formats like DOC, DOCX, and PPT.

    2- For downloading the Apache POI API’s JAR files, go to the link (https://poi.apache.org/download.html) and click on “poi-bin-3.14-beta1-20151223.tar.gz” under the Binary Distribution table. It’ll take you to the mirror sites listing page to download the Apache POI API Jar files folder. Click on any mirror site link, and download and extract the folder.

    3- You will find the following JAR files inside the above folder. Copy all these software files and paste them into the “Lib” folder of “WebdriverDemoProject.”

    1. Poi-3.14-beta1-20151223.jar
    2. Poi-OOXML-3.14-beta1-20151223.jar
    3. Poi-OOXML-schemas-3.14-beta1-20151223.jar
    4. XMLbeans-2.3.0.jar (Inside the OOXML-lib folder)
    5. dom4j-1.6.1.jar (Inside the OOXML-lib folder)
    See also  Selenium Webdriver Interview Questions

    (Note: The above jar files could be upgraded in the future. So, always use the latest version only.).

    Download the Apache log4j Jar File.

    • Log4j is used to generate logs during test execution. We can download Apache log4j files from the link (https://logging.apache.org/log4j/1.2/download.html)
    • Click on the zip folder link, and it will take you to <zip> folder mirror links to download the folder. Click on the mirror link to download the folder.
    • Extract the zip folder inside the folder, and you’ll find the log4j 1.2.17.jar file. Copy this file and save it in the “Lib” folder of “WebdriverDemoProject.”

    Now the “Lib” folder has all the required files. We will add more jar files in the future if necessary.

    Step-6: Add Jar Files in Project Build Path

    Right-click on the project “WebdriverDemoProject.” Select Build Path->Configure Build Path.

    Setup Selenium WebDriver Project-9
    Setup Selenium WebDriver Project-9

    Move to the Libraries tab and click on the “Add External JARs” option. It will open a pop-up for selecting the downloaded JARs.

    Setup Selenium WebDriver Project-10
    Setup Selenium WebDriver Project-10

    Navigate to the “Lib” folder in which all the JARs are available. Select all of them (using Ctrl+A) and then click on the “Open” button. It’ll add all the JAR files to your project’s build path.

    Setup Selenium WebDriver Project-11
    Setup Selenium WebDriver Project-11

    Now click on the “OK” switch to close the window.

    So far, you’ve added all the jar files in the “WebdriverDemoProject” build path. And you are all settled to use the services in your project like the Apache POI, Webdriver, etc.

    A new folder named “Referenced Libraries” gets created in “WebdriverDemoProject,” and all libraries get added under this folder, as shown in the below image.

    Setup Selenium WebDriver Project-12
    Setup Selenium WebDriver Project-12

    With this, you are all set to start writing your Selenium Webdriver test Scripts !!!

    See also  Selenium IDE Download And Installation Guide

    Eclipse IDE – Quick Tips to Setup Selenium Webdriver Project

    • Eclipse IDE brings in the auto-suggest feature, which is quite handy in determining the Selenium Webdriver methods and their parameters. When you add the first line of code to create a Webdriver object like the example shown in the snapshot.
    Setup Selenium WebDriver Project-13
    • You may see some errors. To resolve them, hover the mouse near the Webdriver line containing the issue, and you will see the Autosuggest option, which suggests the possible fix for the errors. In this example importing the Webdriver file will remove the mistake, so choose that option.
    Setup Selenium WebDriver Project-14
    • Again mouse hovers on the Firefox Driver and from the Autosuggest options list, select the option to import the Firefox Driver.
    Setup Selenium WebDriver Project-15
    Setup Selenium WebDriver Project-16

    So, that was about the Eclipse IDE’s Autosuggest option, which is indeed a great help in writing the test scripts.

    Final Word – Setup Selenium Webdriver Project

    In this blog post, we’ve tried to showcase one of the quickest methods to set up the Selenium Webdriver project in Eclipse. If any of you have any suggestions to optimize it further, then please share them with us in the comment box. Also, please use the share icons around and help us to reach this post to a broader audience.

    Best,

    TechBeamers

    Setup Selenium Webdriver
    Previous Article7 Demo Websites You Need to Practice Selenium
    Next Article Selenium Webdriver Interview Questions
    Meenakshi Agarwal

    I'm Meenakshi Agarwal, founder of TechBeamers.com, with 10+ years of experience in Software development, testing, and automation. Proficient in Python, Java, Selenium, SQL, & C-Sharp, I create tutorials, quizzes, exercises and interview questions on diverse tech topics. Follow my tutorials for valuable insights!

    View 3 Comments

    3 Comments

    1. kushal on Jun 18, 2016 11:04 pm

      clear explanation ! thank you so much !

      Just one question : Just like Apache Log4J jar files used to generate logs during test execution, what is the purpose of downloading Apache POI API Jar Files? Can the details added in a bullet.

      Reply
      • Meenakshi Agarwal on Jun 19, 2016 7:20 pm

        Thanks! Your suggestion was a good one. Please see, now we added a bullet to address the usage of Apache POI APIs.

        Reply
    2. Rosy on Apr 08, 2016 12:47 pm

      Nice!!

      Reply

    Leave A Reply Cancel Reply

    Top Selenium Questions
    • Selenium Interview Q&A
    • Selenium Webdriver Q&A
    • Selenium Testing Q&A
    • Common Selenium Q&A
    • Selenium Coding Q&A
    • Selenium Java Q&A
    • Selenium Appium Q&A
    • Selenium Cucumber Q&A
    • TestNG Interview Q&A
    Top Selenium Quizzes
    • Selenium Quiz-1
    • Selenium Quiz-2
    • Selenium Quiz-3
    • Selenium Python Quiz
    • Selenium Appium Quiz
    • Selenium TestNG Quiz-1
    • Selenium TestNG Quiz-2
    Top Selenium Tutorials
    • Selenium WebDriver Download & Install
    • Selenium Report Generation
    • Handle File Upload
    • Handle HTML Tables
    • Handle Keyboard/Mouse
    • Handle AJAX Calls
    • Handle Date-Time Picker
    • Run Selenium Tests Using Task Schedular
    • Selenium to Add Items to a Cart
    Selenium Grid Tutorial
    • Selenium Grid Download
    • Setup Selenium Grid
    Top Selenium Tips
    • Selenium HowTos
    • Selenium Coding Tips
    • Essential Selenium Skills
    • Sample Selenium Resume
    • Selenium Job Profile Tips
    TestNG Tutorials
    • Install TestNG In Eclipse
    • TestNG Annotations
    • TestNG Assertions
    • TestNG Parameters
    • TestNG DataProvider
    • Create TestNG Tests
    • TestNG Using Maven
    • TestNG Result in Excel
    • TestNG Threads - Demo
    • TestNG Factory - Demo
    • Write Data Driven Tests
    Selenium IDE
    • Selenium IDE Download
    • Use Selenium IDE
    • Selenium IDE Add-ons
    Selenium Locators
    • How to Use Locators
    • FireBug & FirePath
    • XPath Chrome Extensions
    • Locator Best Practices
    • Locator Strategies
    Selenium Web Elements
    • Find Web Elements
    • Dropdown & Multi Selects
    • Checkbox & Radio Buttons
    Create Selenium Projects
    • Setup Selenium2 Project
    • Setup Selenium3 Project
    • Use Selenium Maven
    • Selenium Maven Project
    • How to Use IE Driver
    • How to Use Chrome Driver
    Selenium Framework- Java
    • Data Driven Framework
    • Page Object Model (POM)
    • Object Repository (OR)
    • POM vs OR
    Latest Posts
    • 10 Selenium Technical Interview Questions and Answers.
    • 100+ Selenium Interview Questions and Answers You Need to Know in 2024
    • 15 Java Coding Questions for Testers
    • 20 Most Unique Appium Questions and Answers
    • 3 Unique Ways to Generate Reports in Selenium
    • 3 Unique Ways to Handle File Upload In Selenium
    • 35 Selenium Webdriver Questions for Interview

    Subscribe to Updates

    Get the latest tutorials from TechBeamers.

    Loading
    • About
    • Contact
    • Disclaimer
    • Privacy Policy
    • Terms of Use
    © 2023 TechBeamers. All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.