Setting up IntellijIDEA for Selenium

Here we’ll see how to configure intellijIDEA to set up test environment using selenium. Before starting anything, let’s build the environment prior to the configuration of project in intellijIDEA. Below are the checks that we should make:

1. Make sure we have the latest JDK installed in our system which is JDK 6.

2. Collect all the external library file required to do the testing successfully. The are as below.

  • jxl.jar
  • latest testNG jar file
  • the selenium packages (selenium server 2.9 and java version of selenium client drivers)
Once these files are in place, let’s start the configuration.
Step 1: Create the Project
The first step is to create a project. To do so let’s create a project by selecting File – > New Project. Once you click New Project, the following pop up comes up.
Now, let the “Create project from scratch” be selected and click on next. The next screen is as below.
Now provide a name (let’s say ‘Automation’) for the project and select a location where to create the same. Let the Java module be selected and click on next. In the next page, click next. In the next page click on finish. If it asks to select JDK in between, then select your JDK folder which would be there in program files.
Once the project is created the screen looks like the below image.
Step 2: Configure the Project
Now expand the project folder (in this case Automation). Right click on the project name and select New – > Directory. Name the folder as lib. Go to it’s physical location and place the selenium library files, jxl and testNG jar files.  Now we need these file to be referenced by the project to use them. To do so, we need to follow the below steps.
Click on File -> Project Structure. The following window opens up.
Now click on the Modules tab on the left side. Click on the dependency tab on the right side. This looks like as below.
Click on the Add button and click on Library. The window will be shown like the below image.
Now click on Attach Jar Directories. Then select the lib folder and click ok. Enter a library name like Selenium libraries and click Ok. Now all the dependencies are set. Once this is done, right click on the project and create a new directory named resources. There you can place the data sheet for your test. The final folder structure will be shown in the image below.
Now the Project is set. Create new classes in src folder and you are all set. Happy testing 🙂

2 thoughts on “Setting up IntellijIDEA for Selenium

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s