Monday 17 December 2012

SeleniumRC + Webdriver

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.thoughtworks.selenium.Selenium;

public class Webdriver_SeleniumRC {
   
    public static WebDriver driver;
    public static Selenium selenium;
   
    public static String reg() {
        driver=new FirefoxDriver();
        selenium=new WebDriverBackedSelenium(driver, "http://mail.in.com");
        driver.get("http://mail.in.com");
       
        driver.findElement(By.cssSelector("input.registernow")).click();
        driver.findElement(By.id("fname")).sendKeys("Nageswara Rao");
        driver.findElement(By.id("day")).sendKeys("5");
        driver.findElement(By.id("month")).sendKeys("Mar");
        selenium.select("year", "1988");
        selenium.type("username", "nag1234");
        return "Pass";
    }
    public static void main(String[] args) {
        reg();
    }
}

No comments:

Post a Comment