JetBrians has developed a very popular Java IDE (Integrated Development Environment) called IntelliJ, which is widely being used on OSx and Windows. This is another way to show how WebDriver works in various editors and language.


You will need the following components to create and run WebDriver tests in Java.

  • Java
  • JUnit Test Framework
  • IntelliJ
  • Standalone Server Library
  • Firefox Proxy

 IntelliJ IDEA has two versions.

  • Ultimate (Commercial) – It supports a number of development scenarios.
  • Community (Free) – It is used for Java VM and Android development.
                                                                   IntelliJ IDEA

You can download it from IntelliJ’s homepage for Mac, Linux, and Windows platform. It can be easily installed by just following the on-screen instructions. We will use the default settings while using IntelliJ.

Project Creation
  1. At the startup screen, choose ‘Create New Project’ option.
                                        Creating a New Project
  1. Choose a simple Java project without selecting any library options. Click ‘Next’.
                                 Simple Java Project
  1. Click ‘Next’ without selecting the ‘Create project from template’ checkbox.
                        Creating Project Without Template
  1. Name the project and choose the directory to save the project.
                                   Naming and Saving the Project
  1. This will take you to the home page of IntelliJ project.
                                          IntelliJ Home Page
Adding Standalone Server Library

You can use Maven or Gradle to add WebDriver in your IntelliJ projects. However, there are various other ways to do it.

  1. Download the standalone server and Java WebDriver bindings and save it to a folder.
  2. Go to File->Modules. Click ‘Dependencies’ and add the saved directory using the ‘+’ icon.
                             Adding Standalone Server Library
  1. The dialog will look as below.
                                Project Structure Dialog Box
 Adding Firefox Driver Proxy

You need to add an appropriate Firefox proxy in order to talk to the browser. Since, Firefox’s driver is part of the releases of Mozilla’s Gecko Driver; you need to download the driver, according to the version of Windows (x32/x64). Extract the drivers from the zip file to a location and add the location to the system’s PATH environment variable.

 Writing and Running a Simple Test

You will need test framework like JUnit to write the test cases. Add a new Java file by selecting New->Java class. Name the file and transform it into JUnit test class. You can use IntelliJ properties to import JUnit libraries.

Run the test by right-clicking context menu from the test method’s signature.

You may also like: How to use WebDriver in C# Using Visual Studio

Leave a comment

Your email address will not be published. Required fields are marked *