Setting up your Mac for Java WebDriver Tests

There are a couple of setup steps required before you can run a Java JUnit WebDriver test on your Mac. As always there are a number of different ways this can be done but I will outline one that has worked well for me. I’ll just outline the steps involved first and then go through each of them in a little more detail after:

  1. Download and install “Eclipse IDE for Java EE Developers”
  2. Download and install Java
  3. Download JUnit
  4. Download and install Apache Ant
  5. Download Selenium WebDriver
  6. Create Project and lib folders
  7. Configure the build path (in Eclipse)

(1) Download and install “Eclipse IDE for Java EE Developers”

Go to and click on the downloads link. From this page download and install “Eclipse IDE for Java EE Developers”
Download Eclipse for Java EE Developers

(2) Download and install Java

  • Setup $JAVAHOME
  • Setup $CLASSPATH
  • Verify your Java installation by using [code]java -version[/code]

(3) Download JUnit

Download the following JAR files from :

  • JUnit.jar
  • hamcrest.jar

(4) Download and install Apache Ant

Download and install Apache Ant. For further details on this please see my earlier post on Installing Ant. You can also find a link to Apache Ant page from my Resources page.
Don’t forget to verify your installation with [code]ant -version[/code]

(5) Download Selenium WebDriver

Download the following two JAR file from Selenium HQ Downloads: (see link in the Resources page.)

  • WebDriver jar file
  • Java Bindings jar file

(6) Create Project and lib folders

Eclipse uses a folder called a “workspace” in which all of its projects are located. On first opening Eclipse you will be prompted to specify a default workspace.

Inside this folder create a folder for your project. Inside this project folder create a “lib” folder and add the 4 JAR files you have downloaded earlier. Note you will have to unzip the Java Bindings zip file to get the seelnium-java JAR file.

(7) Configure the build path (in Eclipse)

Right click on the project name, and select Build Path > Configure Build Path. When the dialog is displayed, click on the button for Add External JARs.
From here select the 4 JAR files (hamcrest, junit, selenium-java & selenium-server-standalone) we have added to the /Workspace/Project/lib folder in the previous step.

And that concludes the basic setup required to run Java/JUnit Selenium WebDriver tests on your Mac. You are now ready to create and run a Selenium WebDriver Java test using the JUnit framework. In the next post I will create a simple test and execute it from within Eclipse and also from the Command Line/Terminal using Ant.

Leave a Reply

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