Example usage for org.openqa.selenium By id

List of usage examples for org.openqa.selenium By id

Introduction

In this page you can find the example usage for org.openqa.selenium By id.

Prototype

public static By id(String id) 

Source Link

Usage

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void filterReportsDates(FirefoxDriver driver1, months fromMonth, String fromYear, months toMonth,
        String toYear) throws IOException {
    logger.info("Filter Report From: " + fromMonth + "/" + fromYear + " till: " + toMonth + "/" + toYear);
    driver1.findElement(By.id(applangoDropdowns.REPORT_FROM_MONTH.getValue())).sendKeys(fromMonth.toString());
    driver1.findElement(By.id(applangoDropdowns.REPORT_FROM_YEAR.getValue())).sendKeys(fromYear);
    driver1.findElement(By.id(applangoDropdowns.REPORT_UNTIL_MONTH.getValue())).sendKeys(toMonth.toString());
    driver1.findElement(By.id(applangoDropdowns.REPORT_UNTIL_YEAR.getValue())).sendKeys(toYear);
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void selectReportApplication(WebDriver driver1, applications app) throws IOException {
    logger.info("Select application " + app.getValue());
    driver1.findElement(By.id(applangoDropdowns.REPORT_APP_NAME.getValue())).sendKeys(app.getValue());
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void selectReport(WebDriver driver1, applangoReports reportName) throws IOException {
    logger.info("Select Report " + reportName.getValue());
    driver1.findElement(By.id(applangoDropdowns.REPORT_NAME.getValue())).sendKeys(reportName.getValue());
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void clickOnReportExportCSV(WebDriver driver1, WebDriverWait wait1) throws IOException {
    logger.info("click On Report Export CSV");
    driver1.findElement(By.id(applangoButtons.REPORT_PAGE_EXPORT.getValue())).click();
    System.out.println("--- " + driver1.switchTo().activeElement().getText());
    List<String> browserTabs = new ArrayList<String>(driver1.getWindowHandles());
    assertTrue(driver1.switchTo().window(browserTabs.get(1)).getTitle().equals("Applango Report"));
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

public static void clickOnReportDownload(WebDriver driver1, WebDriverWait wait1) throws IOException {
    logger.info("click On Report Download CSV");
    driver1.findElement(By.id(applangoButtons.REPORT_PAGE_DOWNLOAD.getValue())).click();
    wait1.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[@id=\"buttons\"]/output/a")));
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

private static void openApplicationPage(WebDriver driver, WebDriverWait wait) throws IOException {
    clickOnApplicationLink(driver);/*from w w w  .j a  v  a 2s . c o  m*/
    genericApplangoWebsiteActions.waitUntilWaitForServerDissappears(wait);
    wait.until(ExpectedConditions
            .visibilityOfAllElementsLocatedBy(By.id(applangoButtons.APPLICATION_DROP_DOWN.getValue())));
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

private static String getLicenseCostInAccountPage(RemoteWebDriver driver, WebDriverWait wait)
        throws IOException {
    //        genericApplangoWebsiteActions.openUserAccount(driver, wait);
    //            Click on SF in account page
    driver.findElement(By.xpath("//*[@id=\"applist\"]/div[3]")).click();
    waitUntilWaitForServerDissappears(wait);
    return driver.findElement(By.id("licenses")).getText();
}

From source file:applango.common.services.Applango.genericApplangoWebsiteActions.java

private static void checkVisibilityOfHomePageTables(WebDriverWait wait1) throws IOException {
    logger.info("Check visibility of HOME_PAGE_BITS, groupAnalytics, licenseAnalytics, minimalUsers");
    wait1.until(ExpectedConditions/*from  w ww  .  j  av  a  2s. co m*/
            .visibilityOfAllElementsLocatedBy(By.id(applangoObject.HOME_PAGE_BITS.getValue())));
    wait1.until(ExpectedConditions
            .visibilityOfAllElementsLocatedBy(By.id(applangoObject.HOME_PAGE_groupAnalytics.getValue())));
    wait1.until(ExpectedConditions
            .visibilityOfAllElementsLocatedBy(By.id(applangoObject.HOME_PAGE_licenseAnalytics.getValue())));
    wait1.until(ExpectedConditions
            .visibilityOfAllElementsLocatedBy(By.id(applangoObject.HOME_PAGE_minimalUsers.getValue())));
}

From source file:AQ.TeamsUnitTest.java

@Test
public void hello() {
    WebDriver driver = webDriver;/*from w w w. j  a  v a 2s .  co m*/
    int noTeams = 3;

    driver.get(baseUrl + "/champgen/faces/index.xhtml");
    driver.findElement(By.linkText("Login")).click();
    driver.findElement(By.id("login-form:username")).sendKeys("admin");
    driver.findElement(By.id("login-form:password")).sendKeys("admin");
    driver.findElement(By.id("login-form:btnSubmit")).click();
    driver.findElement(By.linkText("New Championship")).click();
    driver.findElement(By.id("new-championship-form:name")).clear();
    driver.findElement(By.id("new-championship-form:name")).sendKeys("TestChamp1");
    driver.findElement(By.id("new-championship-form:btnSubmit")).click();
    assertTrue(driver.findElement(By.id("msg:info")).getText().matches("^[\\s\\S]*added ![\\s\\S]*$"));

    for (int i = 0; i < noTeams; i++) {
        driver.findElement(By.linkText("New Team")).click();
        driver.findElement(By.id("newteam-form:team")).clear();
        driver.findElement(By.id("newteam-form:team")).sendKeys("Team" + i);
        driver.findElement(By.id("newteam-form:leader")).clear();
        driver.findElement(By.id("newteam-form:leader")).sendKeys("Leader" + i);
        driver.findElement(By.id("newteam-form:btnSubmit")).click();
    }

    this.pause(TIME_TO_PAUSE);
    this.pause(TIME_TO_PAUSE);

    driver.get(baseUrl + "/champgen/faces/index.xhtml");

    int rowCount = webDriver.findElements(By.xpath("//table/tbody/tr")).size();
    System.out.println(rowCount);
    assertTrue(rowCount == noTeams + 1); // + 1 because title is counted as row

    this.pause(TIME_TO_PAUSE);
}

From source file:assignment2.Task4DtmlxInvalidDetails.java

@Test
public void abc() throws InterruptedException {
    Thread.sleep(3000);/*from  w w  w.ja  v  a2  s . com*/
    getDriver().manage().window().maximize();

    WebElement ele1 = getDriver()
            .findElement(By.xpath("html/body/div[1]/header/div[1]/div/div/div/div/nav/ul/li[1]/a"));

    Actions action = new Actions(getDriver());
    action.moveToElement(ele1).build().perform();
    Thread.sleep(2000);

    WebElement ele2 = getDriver()
            .findElement(By.xpath("html/body/div[1]/header/div[1]/div/div/div/div/nav/ul/li[1]/ul/li[3]/a"));
    action.moveToElement(ele2).build().perform();
    Thread.sleep(2000);

    getDriver().findElement(By.xpath(
            "html/body/div[1]/header/div[1]/div/div/div/div/nav/ul/li[1]/ul/li[3]/ul/li[6]/ul[2]/li[2]/a"))
            .click();
    Thread.sleep(2000);

    getDriver().findElement(By.xpath("html/body/div[4]/header/div[1]/div/div/div/div/nav/ul/li[4]/a")).click();

    getDriver().findElement(By.id("email")).sendKeys("abc@apple.com");
    getDriver().findElement(By.id("license")).sendKeys("Abcabc123!");

    String output = getDriver().findElement(By.xpath(".//*[@class='submit-error m-bottom-30']")).getText();
    String input = "ERROR: Invalid e-mail or license number";
    Assert.assertEquals(output, input);
    Thread.sleep(1000);

}