Saturday, 2 May 2015

Functional testing on gmail login page using automation.

package Assignments;

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

public class FuncTestOnGmail {

public static void main(String[] args) throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.get("http://gmail.com");

String Expcase1 = "Enter your email address";
String Expcase2 = "Enter your password";
String Expcase3 = "The email or password you entered is incorrect";

//Case 1

driver.findElement(By.id("Passwd")).sendKeys("gsgsgs");
driver.findElement(By.id("signIn")).click();
String Actcase1 = driver.findElement(By.xpath("//span[contains(text(),'Enter your email address.')]")).getText();
if(Actcase1.contains(Expcase1))
{
System.out.println("Case 1 PASS!!");
}
else
{
System.out.println("Case 1 FAIL!!");
}
driver.get("http://gmail.com");
Thread.sleep(4000);


//Case 2

driver.findElement(By.id("Email")).sendKeys("duhudhe");;
driver.findElement(By.id("signIn")).click();
String Actcase2 = driver.findElement(By.xpath("//span[contains(text(),'Enter your password')]")).getText();
if(Actcase2.contains(Expcase2))
{
System.out.println("Case 2 PASS!!");
}
else
{
System.out.println("Case 2 FAIL!!");
}
driver.get("http://gmail.com");
Thread.sleep(4000);


//Case 3

driver.findElement(By.id("Email")).sendKeys("ydgygdycgd");
driver.findElement(By.id("Passwd")).sendKeys("hxcgdygy");
driver.findElement(By.id("signIn")).click();
String Actcase3 = driver.findElement(By.xpath("//span[contains(text(),'The email or password you entered is incorrect')]")).getText();
if(Actcase3.contains(Expcase3))
{
System.out.println("Case 3 PASS!!");
}
else
{
System.out.println("Case 3 FAIL!!");
}

driver.quit();

}

}


1 comment:

  1. Awesome to see your site. Keep up the great work. Thanks for all you could do.Lets stay in touch

    gmail login page online

    ReplyDelete