Setting up Selenium WebDriver

For this post I will go through how to set up your Selenium WebDriver automation framework by importing the relevant jar files.

The jar files and versions you will need for your Selenium framework are:

  1. junit – version 4.10
  2. selenium java – version 2.45.0
  3. selenium server standalone – version 2.45.0

I have uploaded these files to my domain, so you can either download them by clicking on the names above or you can get them directly from the Selenium website.

After you have downloaded the above files open your IDE and start a new Java project. I prefer to use IntelliJ IDEA but you can use anything you prefer.

Once the project has been set up we will need to create a folder to store our jar files inside. So right click on the project structure and select New > Directory. A popup should appear asking for the folder name, give the folder a sensible name, I have called mine libs. Drag and drop the downloaded files into this folder.

libs
Your project structure should look like this with the libs folder containing 3 jar files

Next you will need to right click on the project and select “Open Module Settings” or press the F4 key on your keyboard.

Open the dependencies tab and add a Java library. The screenshot below will you how this should look like. Navigate to the libs folder and select to add the jar files. Note: you may have to add them one by one.

Dependencies
Add Java Library as a dependency

After the files have been added in you should see the 3 jar files appear in the list of dependencies. This now indicates that you can use selenium in your project.

AddedDependencies
Once your jar files have been added they should appear in the list of Dependencies

Now all you have to do is in the src add a class and you can start writing your automated test. Have a look at the previous post I have written about Writing a basic Selenium test.

One comment:

Leave a Reply