Thursday, April 14, 2016

Selenium Login script

Selenium provides a record/playback tool for authoring tests without the need to learn a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including C#, Groovy, Java, Perl, PHP, Python, Ruby and Scala.

This is the selenium login script.

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

import com.thoughtworks.selenium.SeleneseTestCase;

public class TestCase1 extends SeleneseTestCase {
    public void setUp() throws Exception {

    public void login() {
        WebDriver driver = new FirefoxDriver();
        WebElement id = driver.findElement("username"));
        WebElement pass = driver.findElement("password"));
        WebElement button = driver.findElement(By.xpath("/html/body/div/div/div[2]/div/form/p[3]/input"));      


No comments:

Post a Comment