- Install Eclipse 3.5
- Download JUnit
- Download Selenium RC
- Run java -jar selenium-server-1.0.3/selenium-server.jar
- Create a Java project in Eclipse
- Right-click on the project name and go to Properties | Java Build Path | Add External JARs
- add JUnit JAR
- all the Selenium Server JARs
- all the Selenium Java JARs
- Run a program like this (This one doesn't actually work; the assertion fails)
package com.example; import junit.framework.TestCase; import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; public class GoogleTest extends TestCase { private static Selenium selenium; protected void setUp() { selenium = new DefaultSelenium("localhost" , 4444 , "*firefox", "http://www.google.com"); selenium.start(); selenium.setSpeed("2000"); } public final void testTitle() { selenium.open("http://www.google.com"); selenium.type("//input[@title='Google Search']", "I am using selenium"); selenium.click("//input[@value = 'Google Search']"); assertTrue(selenium.isElementPresent("/html/head/title")); } protected void tearDown() { selenium.stop(); } }