To configure Eclipse with Selenium WebDriver, we need to perform the following activities:

Launch the Eclipse IDE & Create a Workspace

Create a new Project

Create a new Package

Create a new Class

Add External libraries to the project

Launch the Eclipse IDE & Create a Workspace

1) Double click on ‘eclipse.exe‘ to start eclipse. First time when you start eclipse, it will ask you to select your workspace where your work will be stored as shown in below image.

2) Create a ‘working directory’ for all of your projects. Think of it like ‘My Documents’ in the Windows operating system. It’s a folder which contains a lot of your documents, but there’s nothing to prevent you from creating another folder called ‘My Other Documents‘ (for instance) to house other documents.

Typically you only need one workspace, and you can think of it as your ‘My Documents‘ for Java code. If you wanted to, you could have more than one, but chances are you won’t have a use for more. I like to choose my own workplace location and will place all my ToolsQAtutorial projects under it.

You can change it later on from ‘Switch Workspace‘ under ‘File‘ menu of eclipse. After selecting workspace folder, Eclipse will be open.

3) You may see the window like this, this is the Welcome window for Eclipse. You may close this window.

Create a new Project

Projects: A collection of related code. Generally speaking, each project encompasses one independent program. Each programming assignment you do will typically require its own project.

Once you’ve established your workspace, you’ll want to create a project and begin writing code. In Eclipse, projects are the next-smallest functional unit after workspaces, but where you might have only one workspace, you will usually have several projects inside one workspace.

1) Create new Java Project from File > New > Project .

2) Select Java Project and click Next.

3) Give your Project name ‘OnlineStore‘ as shown in below given figures. Click on Finish button.

Note: I am naming this as OnlineStore, as Toolsqa.comgives you the opportunity to practice automation on Live demo site. This demo website is a complete ecommerce website where a customer can register and purchase electronic items.

Note: In case of not creating class for Main test case, please do not click ‘public static void main’. We need to select it only in case of writing test cases which we are going to execute and from where we call other classes. For functional classes, POM classes or any other classes we don’t need this to be checked.

3) Now your Eclipse window will looks like bellow.

Add External Jars to Java build path

Now you need to add Selenium WebDriver’s Jar files in to Java build path.