public class Keywords {
private WebDriver driver;
@
Keyword
public void openBrowser(String url) {
driver = new FirefoxDriver();
driver.get(url);
}
@
Keyword
public void login(String email, String password) {
driver.findElement(By.xpath(".//*[@id='login-form:email']")).sendKeys(email);
driver.findElement(By.xpath(".//*[@id='login-form:password']")).sendKeys(password);
driver.findElement(By.xpath(".//*[@id='login-form:login']")).click();
}
@
Keyword
public void checkLoggedInAs(String fullName) {
Assert.assertEquals(fullName, driver.findElement(By.xpath(".//*[@class='login']")).getText());
}
@
Keyword
public void closeBrowser() {
driver.quit();
}
}
4 października 2015
0 Likes