A Gentle, Newbie-Friendly Guide to Installing Selenium WebDriver – Part 1: Use Maven!

For my first (meaningful) post, I thought a good place to start would be to share how I went about installing everything that I needed to start doing automated testing with Selenium WebDriver. There are multiple ways to get up and running with Selenium but this is my approach. Its a fairly easy way to get started quickly whilst also being quite comprehensive.

This guide will detail how to get started with Selenium WebDriver using Java. We will use Maven as the build tool and Junit as the testing framework. Don’t worry if you don’t know much about Maven or Junit at this stage (when I started doing automation, I didn’t have a clue what either were really!) – it will become clearer as we go on.

I am going to split this guide into very small and easy to digest sections. This section will only talk about getting started with Maven.

apache-maven-project
Using Maven as our build tool will allow us to run our tests with a single line from the command line. The major benefit of this is that it will make it easy to integrate our automation tests into a Continous Integration tool such as Jenkins at a later date. This is a bit advanced for us at this stage, but its worth taking these steps to prepare for it now.

Another great thing about using Maven is that it makes the installation of everything needed for Selenium really easy, we just need to add a few lines to a file called the POM. If you don’t know anything about Maven I highly recommended you read the Maven 5 minute quickstart guide here – http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

I won’t repeat the information in the guide here, but the best way to learn is by actually doing and so I strongly suggest that you follow the guide step-by-step and create a new (dummy) project. We won’t use said project for our actual automation project, but just having even a small amount of exposure to Maven in this way will help as we continue to get setup.

So by following the guide above you should have at least a very rough idea of what Maven is, how it works, and have created a dummy project. In the next post, we are going to install a Java IDE (Integrated Development Environment), which is where we will be writing our tests.