importjava.util.concurrent.TimeUnit;
importorg.junit.*;
importstaticorg.junit.Assert.*;
importstaticorg.hamcrest.CoreMatchers.*;
importorg.openqa.selenium.*;
importorg.openqa.selenium.firefox.FirefoxDriver;
importorg.openqa.selenium.support.ui.Select;
publicclassjuuuuuuuuuuuuuuu {
privateWebDriverdriver;
private String baseUrl;
privatebooleanacceptNextAlert = true;
privateStringBufferverificationErrors = newStringBuffer();
@Before
publicvoidsetUp() throws Exception {
driver = newFirefoxDriver();
baseUrl = "https://accounts.google.com/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
publicvoidtestA() throws Exception {
driver.get(baseUrl + "/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1<mpl=default<mplcache=2&emr=1&osid=1#identifier");
driver.findElement(By.id("Email")).clear();
driver.findElement(By.id("Email")).sendKeys("sureshdobbari");
driver.findElement(By.id("next")).click();
driver.findElement(By.id("Passwd")).clear();
driver.findElement(By.id("Passwd")).sendKeys("venkanna");
driver.findElement(By.id("signIn")).click();
driver.findElement(By.linkText("sureshdobbari@gmail.com")).click();
driver.findElement(By.id("gb_71")).click();
}
@After
publicvoidtearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
privatebooleanisElementPresent(By by)
{
try {
driver.findElement(by);
returntrue;
} catch
(NoSuchElementException e) {
returnfalse;
}
}
privatebooleanisAlertPresent() {
try {
driver.switchTo().alert();
returntrue;
} catch
(NoAlertPresentException e) {
returnfalse;
}
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
returnalertText;
} finally {
acceptNextAlert = true;
}
}
}
This comment has been removed by the author.
ReplyDelete