Monday 12 September 2011

Selenium RC + JUnit Sample Script

Below is the sample script using JUnit 

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.server.SeleniumServer;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class yahoo{

private Selenium selenium;
private SeleniumServer seleniumServer;

@Before
public void setUp() throws Exception {
    selenium = new DefaultSelenium("localhost", 4444, "*iehta", "http://");
    seleniumServer = new SeleniumServer();
    seleniumServer.start();
    selenium.start();
    }
@Test
    public void testText1() throws Exception {
    selenium.open("http://www.yahoo.com");
    selenium.windowMaximize();
    }
@After
    public void tearDown() throws Exception {
    selenium.stop();
    seleniumServer.stop();
    }
}

No comments:

Post a Comment