/** * this method is used to log in to Red Mine. * * @param userName username for the Red mine. * @param password Password for the Red Mine. * @return RedMineHomePage * @throws IOException for input output exceptions */ public RedMineHomePage loginToRedMine(String userName, String password) throws IOException { log.info("login as " + userName); WebElement userNameField = driver.findElement(By.name(uiElementMapper.getElement("red.mine.login.username.name"))); WebElement passwordField = driver.findElement(By.name(uiElementMapper.getElement("red.mine.login.password.name"))); userNameField.sendKeys(userName); passwordField.sendKeys(password); driver .findElement(By.name(uiElementMapper.getElement("app.redMine.login.button.name"))) .click(); return new RedMineHomePage(driver); }
public WebAppListPage(WebDriver driver) throws IOException { this.driver = driver; UIElementMapper uiElementMapper = UIElementMapper.getInstance(); // Check that we're on the right page. driver.findElement(By.xpath(uiElementMapper.getElement("webapp.list.xpath"))).click(); if (!driver .findElement(By.id(uiElementMapper.getElement("webapp.list.page.middle"))) .getText() .contains("Running Applications")) { throw new IllegalStateException("This is not the Running Web Applications Page"); } }
public RedMineLoginPage(WebDriver driver) throws IOException { this.driver = driver; this.uiElementMapper = UIElementMapper.getInstance(); // Check that we're on the right page. if (!(driver.getCurrentUrl().contains("redmine"))) { throw new IllegalStateException("This is not the Red mine page"); } }