Hello all, this is script for Gmail Sign-in through Selenium Webdriver by using xpath as a locator. I have use xpath in locating HTML elements. Xpath can be easily generate from Firebug.
public class loginuser {
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(1, TimeUnit.MINUTES);//Wait
driver.get("www.gmail.com");
//Login
driver.findElement(By.xpath("//*[@id='Email']")).sendKeys("Username");
driver.findElement(By.xpath("//*[@id='Passwd']")).sendKeys("password");
driver.findElement(By.xpath("//*[@id='signIn']")).click();
driver.close();
// Quit the driver
driver.quit();
}
}
0 Comment(s)