Selenium Webdriver is the most popular open source web test automation framework across wide range of browsers and platforms. In this tutorial you will learn how to do web test automation with Selenium Webdriver and the related tools.


This tutorial is designed for beginners who have little or no automation experience. At the end of this tutorial, you will have a web automation environment and you will write your first Selenium automation script.


Web Automation Framework: Selenium Webdriver

Development Kit: JAVA JDK

Web Browser: Firefox

Java Test Runner: JUnit

IDE: IntelliJ (I prefer IntelliJ) also you can go with Eclipse

Build System: Maven

Environment Editor (Optional): Rapid Environment Editor (RapidEE)

Nice to have: Before starting this tutorial, it is nice to have basic knowledge on JAVA or any other object-oriented programming languages.

Step-By-Step Instructions

Step-1: Installing Firefox

Link: https://www.mozilla.org/tr/firefox/new/

You can download the latest version of Firefox web browser above link. When you downloaded the setup file, you can easily install it by pressing “Next” buttons.

Step-2: Installing Firefox Add-ons

1- Firebug: Go to http://getfirebug.com/ and click “Install Firebug” button and do the followings:

Note: The Firebug extension isn’t being developed or maintained any longer. We invite you to use the Firefox DevTools instead, which ship with Firebug.next. See also Migration from Firebug guide.


• Click Download link.


• Click “Add to Firefox” button.


• Click “Install Now” button.


• You will see “Firebug has been installed successfully.” Message.


• Open a website and press “F12” button. Firebug automatically opens and with Firebug we can easily analyze HTML, CSS, DOM, cookies of all websites very easily.


Brief Explanation of How to Use Firebug:

• First, click the pointer icon.


• Then, select any element of the website, then firebug automatically highlights its html.


• When you right click the highlighted html, you easily reach its XPath and CSS selectors.


2- FirePath: You can edit, inspect and generate Xpath 1.0 expressions, CSS 3 selectors and JQuery selectors with FirePath. To install FirePath go to https://addons.mozilla.org/en-US/firefox/addon/firepath/ and click “Add to Firefox” button and then click “Install Now” button. When it is installed, restart the Firefox.

Brief Explanation of How to Use FirePath:

• First click F12 button to open FireBug, then you will see FirePath tab at the most right side as shown below.


• Then, for example if you highlight all paragraph, just type “.//img” then press enter.


Also, you can get an element’s XPath expression:


To find an element’s CCS selector, you can do the followings:



Step-3: Installing Environment Editor

With RapidEE you can easily edit Windows Environment Variables. To get RapidEE, go to http://www.rapidee.com/en/download download suitable version with respect to your windows operating system and install it by pressing “Next” buttons. When your installation finished, you will see below window.


Step-4: Installing JAVA JDK

Go to http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and select appropriate version of JDK and click “Accept License Agreement” and download JAVA JDK as shown below.


• After downloading JAVA JDK, you can install it by clicking “Next” buttons as shown below:






• Then we should check JAVA with command prompt by typing following command “java –version”. This command will give us JAVA version and this means we have successfully installed JAVA JDK.


Step-5: Installing Maven (Build Tool)

Based on the concept of  project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information. It is the easiest way installing Selenium. It can automatically download all dependencies which are written in your pom.xml file and build your project with standard project layout format. You can find all details about maven from https://maven.apache.org/index.html

To install maven first go to download page (https://maven.apache.org/download.cgi) and click “binary zip archive”


When you downloaded the installation file, then we should follow the instructions which are written on https://maven.apache.org/install.html page.

1- First, copy “apache-maven-3.3.3-bin.zip” and paste under “C:\Program Files” and then extract it. After extracting package it will look like as below.


2- Set JAVA_HOME environment variable.

• Open RapidEE and click “Add new variable” button.


• Write “JAVA_HOME” as variable name.


• Then press “F7” and select the JAVA JDK path (C:\Program Files\Java\jdk1.8.0_60) and then click “OK” button.


• Finally, save the changed setting by clicking save icon.


3- Adding maven folder (C:\Program Files\apache-maven-3.3.3\bin) into the PATH variable.

• First select path variable


• Then click “Add value to the current variable


• Copy and paste maven bin directory and press enter. Then click save button.


4- Check maven installation is succeeded or not.

• Open a cmd window and type “mvn –v” then press enter. You should see below result.


Step-6: Installing IDE (IntelliJ)

We will write our test automation codes by using IDE. There are two major IDE version in the market now. They are Eclipse and IntelliJ. In this tutorial I will go with IntelliJ. If you want to familiar with Eclipse you can go on with Eclipse IDE.

JetBrains is developing IntelliJ and you can download its community edition version for free from their website. Its download link: https://www.jetbrains.com/idea/download/

When you download setup file, you can complete the installation by clicking next buttons. It is so easy.

Step-7: Starting to Automate with Selenium Webdriver & Maven & JUnit & IntelliJ

This is the most critical step of this tutorial. At the end of this step we will have done our first automation project. We are using Maven as our build tool so it will automatically downloads everything we need for web test automation. So, now let’s start to automate step-by-step.

1) Open IntelliJ and click “Create a New Project”


2) Select “Maven” as project type and then browse JAVA folder as Project SDK and then click the “Next” button.


3) Fill GroupId and ArtifactId for maven project as you wanted. In this example I preferred to write “firstSeleniumTest”


4) Give a name to you project and then click “Finish” button. I selected “firstSeleniumTest” as my project name.


5) After clicking “Finish” button, our project will be created and you will see below screen. Then, you should click “Enable Auto-Import”. Thus, when you change your pom.xml maven automatically imports the required files according to your changes.


6) You can see project tree by clicking arrow icons. In pom.xml we hold all of our maven information. Under the testàjava we will create our first selenium test automation file.


7) It’s time to get JUnit to automate our first Selenium test. Hence, you should go https://github.com/JUnit-team/JUnit/wiki/Download-and-Install and copy Maven dependency code snippet.


8) Go to pom.xml file and create <dependencies> </dependencies> section and paste JUnit dependency into it. Before, we clicked “Enable Auto-Import” so after pasting JUnit dependency, IntelliJ automatically imports related JUnit files into our project.


9) Now, we will get Selenium Webdriver. It will be our test automation framework. For this, you should go to http://www.seleniumhq.org/download/maven.jsp, copy maven dependency and paste in to our pom.xml’s dependencies section.


• After pasting Selenium dependency, IntelliJ automatically starts to download related files.


Finally, we finished to prepare everything. Let’s start automation!

Note: You can check how to use Selenium 3.o in this article.

10) Go to project tree, right click on java folder, then go to New, and then click “Java Class”


11) After that give a name to your first automation test and then click “OK”.


12) If you want to organize your test files, you can put them into a package. To do this, Right click to java folder, click “Package”.


• Then give a name to a package and click “OK”.


• Drag&Drop FirstAutomation test file to our package.


• After that, our automation test file is located new created package as shown below.


13) Now we will start to write test automation code. I tried to emphasize important information with comments in below code.

10) It is time to run the code! 🙂 To do this you can click run icon on upper menu or right click test automation file and then click Run ‘FirstAutomationTest’ or you can just press ctrl+shift+F10


• If the test passed you will see this on output screen as shown below.


• When test is failed, the output screen will look like below. You will get detailed error info on output screen.


Extra Info: Important points while you are writing your code with IntelliJ

  • When you start to write your class, IntelliJ automatically shows all the classes starts with your class first letters.


  • When you select your class, IntelliJ automatically imports related source classes.


  • IntelliJ automatically shows all Classes when you are instantiating an object.


  • After object name if you put a dot, it shows that object’s methods.



  • Installed FireBug & FirePath and learned their usage.
  • Installed JAVA JDK.
  • Installed Maven.
  • Set required environmental variables for JAVA JDK and Maven.
  • Installed IntelliJ and learned how to create a Maven project.
  • Wrote our first test automation code and run it.
  • Learned important key points of IntelliJ while you are coding.


Selenium, Webdriver, Java, IntelliJ, Maven, JUnit, Automation, Web Test Automation, RapidEE, FireBug, FirePath