Installing Selenium 2.0, maven,testng and eclipse.

I think I did struggle a bit to have this installed, and by trial and error I finally got it working on my mac. Here is what worked for me, if while installing you come across any problems please feel free to leave me a comment. Check if java is installed by typing java -version, if java does exist no error is displayed. Else install java before proceeding.

1. Start out by installing eclipse.( I have Indigo installed)

2. Launch eclipse, now within eclipse go to help->install new software and plug-in in the URL and follow the process to install maven.

3. Similarly install testng with

4. Now click on File->new->java project.

If you see a warning like

Description Resource Path Location Type
Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment. another project Build path JRE System Library Problem then to fix it , right click on the java library , build path and remove it. RIght click on the project->build path->configure build path ->add library->JRE system library->next, and pick the default java library

5. Right click on the project ->maven ->enable dependency. Observe that maven dependencies library and bin/source folders are created.

 5. Right click on the pom.xml file that is present and open with a text editor, replace with

<?xml version="1.0" encoding="UTF-8"?>

make sure that the version is the latest as displayed here

6. Right click on the project and go to maven->update dependencies.

7. Click on File->new->source folder. Create structure /src/test/java.

8. Create new package (example) and class (google) paste the following test example:

package example;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class google {
public static void main(String[] args) {
// Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new FirefoxDriver();

// And now use this to visit Google
// Alternatively the same thing can be done like this
// driver.navigate().to("");

// Find the text input element by its name
WebElement element = driver.findElement("q"));

// Enter something to search for

// Now submit the form. WebDriver will find the form for us from the element

// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());

// Google's search is rendered dynamically with JavaScript.
// Wait for the page to load, timeout after 10 seconds
(new WebDriverWait(driver, 10)).until(new ExpectedCondition() {
public Boolean apply(WebDriver d) {
return d.getTitle().toLowerCase().startsWith("cheese!");

// Should see: "cheese! - Google Search"
System.out.println("Page title is: " + driver.getTitle());

//Close the browser

9. Now select project and click the play button.

10. VIOLA!

I have added testng functionality to the project but have not utilized it yet. I referred to jc webconcepts and the selenium site to help me with the installation. So thanks!

This is what my view looks like



2 thoughts on “Installing Selenium 2.0, maven,testng and eclipse.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s