To create my first test in Selenium, I was using this web site.

Download and install Eclipse, download Chrome driver, download and install Maven.

To install Maven, in my case, I downloaded, and I extracted it to C:\opt\maven. After that on the keyboard click Windows sign + Pause, system properties should open, and click Advanced Settings. On Windows 7 it looks like this:

System properties window should pop - up, click on Advanced -> Environment Variables:

Environment Variables should pop - up. First I had to add M2_HOME variable with the value C:\opt\maven into system variables, because with user variables didn't work, I don't know why:

Then in user variables click new:

Add the M2 environment variable in the user variables with the value %M2_HOME%\bin

Add / update path variable, by adding %M2%:

 Make sure that Java_Home exists:

After adding all those variables, I had to restart my computer, then to check if everything is correctly set in command line write 

echo %M2_HOME%

result should be (in my case):


Now we can check if Maven is installed by writing in command line:

mvn --version

Result should be something like: 

Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T15:51:42+02:00)
Maven home: C:\opt\maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_45\jre
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

To start with Maven, create folder for example d:\, open command line in that folder, execute:

mvn archetype:generate -DartifactId=my-firstTest -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Now your folder structure should look like:

Open Eclipse, go to Help -> Install New Software:


Then, in my case, I've choose Work with: Luna -, filtered by maven, and check Collaboration m2e...:

Click Next -> Next -> Accept license agreement -> Finish, wait to install software, restart Eclipse.

Go to File -> Import

Then choose Existing Maven Projects

Click Browse go to folder where is your project (in my case that is d:\, click ok -> Finish.

Open pom.xml, since I am unexpirienced Eclipse user I open it with Text Editor:

It should look like:

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

Basically you will need to add just:


After saving, Maven Dependencies should be populated, in my case it looks something like:

Now, open my-firstTest -> src/test/java -> ->, right click on -> New -> Class

Give the name like openChrome

Open your new file, in my case, and write something like:


import junit.framework.TestCase;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class openChrome
	extends TestCase
	WebDriver driver;
	public void testDevice_183_102_1152921504606846975() throws InterruptedException {
		System.setProperty("", "C:\\Users\\myUserName\\Downloads\\chromedriver_win32\\chromedriver.exe");
		driver = new ChromeDriver();

Part C:\\Users\\myUserName\\Downloads\\chromedriver_win32\\chromedriver.exe change with path where you downloaded your chromedriver.

After adding the code, there is possibility that @Test will be underlined with red color, which means that it is not recognized. In that case go with mouse over @Test, wait for drop down window, and click on "Add JUnit 4 library to the building path":

Click F11, and magic should happen.

Example project you can download from here, but be aware that this is my very first project made in Selenium / Java.