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:AM.Physician.AddNewPhysician.java

public static WebElement chk_AP_ExternalReferral(WebDriver driver) {
    element = driver.findElement(By.id("ExternalReferral"));
    Waits.ForElementVisibility(driver, element);
    return element;
}

From source file:AM.Physician.AddNewPhysician.java

public static Select lst_AP_InternalReferralSource(WebDriver driver) {
    element = driver.findElement(By.id("fClinicUserKeyInternalReferral"));
    list = new Select(driver.findElement(By.id("fClinicUserKeyInternalReferral")));
    Waits.ForElementVisibility(driver, element);
    return list;// w  w w  .  j a v  a2  s  . c o m
}

From source file:AM.Physician.AddNewPhysician.java

public static WebElement txt_AP_AlternateAddress(WebDriver driver) {
    element = driver.findElement(By.id("altAddr"));
    Waits.ForElementVisibility(driver, element);
    return element;
}

From source file:AM.Physician.AddNewPhysician.java

public static WebElement btn_AddPhysician(WebDriver driver) {
    element = driver.findElement(By.id("submitBtn"));
    Waits.ForElementVisibility(driver, element);
    return element;
}

From source file:applango.common.dashboardTests.java

@Test
public void testExcludeUsers() throws ParserConfigurationException, SAXException, IOException {
    driver1 = getRemoteWebDriver(DesiredCapabilities.firefox());
    WebDriverWait wait = new WebDriverWait(driver1, timeOutInSeconds());
    Applango applango = getApplangoConfigurationXML();
    Salesforce sf = genericSalesforceWebsiteActions.getSalesforceConfigurationXML();
    final String connection = dbTables.excludedUser.getValue().toString();
    DBCollection coll = db.getCollection(connection);

    try {//ww  w  .  ja v  a  2 s .  c o  m
        BasicDBObject documentBuilder = new BasicDBObject("appName", "salesforce")
                .append("customerId", "automationCustomer").append("externalId", "005b0000000w0ytAAA");
        //userId : zzzzchatteruser2888@applangoqa.com
        String lastName = "excludedUser";

        logger.info("Check that user is in [excludedUser] table");
        if (coll.count(documentBuilder) != 0) {
            genericApplangoWebsiteActions.openDashboardAndLogin(applango, driver1, wait);
            genericApplangoWebsiteActions.enterValueInSearchLastName(driver1, lastName);
            logger.info("Check that user not exist in usertable");
            assertFalse(driver1.findElement(By.id(applangoObject.USERTABLE.getValue().toString())).getText()
                    .contains(lastName));
        }
    } catch (Exception ex) {
        ex.getMessage();
    } finally {
        driver1.close();
    }
}

From source file:applango.common.dashboardTests.java

@Test
public void testGroupByLicenseType() throws ParserConfigurationException, SAXException, IOException {
    Applango applango = getApplangoConfigurationXML();
    driver1 = getRemoteWebDriver(DesiredCapabilities.chrome());
    WebDriverWait wait = new WebDriverWait(driver1, timeOutInSeconds());
    final String connection = dbTables.groupInfo.getValue().toString();
    DBCollection coll = db.getCollection(connection);
    String licenseType = salesforceLicenses.FORCE.getValue().toString();
    try {//from w  w w  . ja  va  2  s.c o m
        BasicDBObject documentBuilder = new BasicDBObject("appName", "salesforce")
                .append("customerId", "automationCustomer").append("externalId", "00520000003ClOvAAK");
        String lastName = "Hilsta";
        logger.info("Check that user is in [groupInfo] table with group 'Chatter Free'");
        if (coll.find(documentBuilder).next().get("groups").toString().toLowerCase()
                .contains(licenseType.toLowerCase())) {
            genericApplangoWebsiteActions.openDashboardAndLogin(applango, driver1, wait);
            driver1.manage().window().maximize();

            //                driver.findElement(By.id("//*[@id=\"licenz\"]/span[2]")).click();

            logger.info("Check that user exist in usertable when filtering by " + licenseType);
            genericApplangoWebsiteActions.filterLicenseType(driver1, wait, salesforceLicenses.FORCE);
            genericApplangoWebsiteActions.enterValueInSearchLastName(driver1, lastName);
            assertTrue(driver1.findElement(By.id(applangoObject.USERTABLE.getValue().toString())).getText()
                    .contains(lastName));
            //check Groups field

            logger.info("Check that user not exist in usertable when filtering by "
                    + salesforceLicenses.SYSTEM_ADMINISTRATOR.getValue());
            genericApplangoWebsiteActions.filterLicenseType(driver1, wait,
                    salesforceLicenses.SYSTEM_ADMINISTRATOR);
            genericApplangoWebsiteActions.enterValueInSearchLastName(driver1, lastName);
            assertFalse(driver1.findElement(By.id(applangoObject.USERTABLE.getValue().toString())).getText()
                    .contains(lastName));
        }
    } finally {
        driver1.close();
    }
}

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

public static void selectApplication(WebDriver driver1, WebDriverWait wait, applications app)
        throws IOException {
    if (!isApplicationAlreadySelected(driver1, app)) {
        logger.info("Selecting application " + app);
        wait.until(ExpectedConditions/*from  w  ww .ja v  a2  s  .c o  m*/
                .visibilityOfElementLocated(By.id(applangoButtons.APPLICATION_DROP_DOWN.getValue())));
        driver1.findElement(By.id(applangoButtons.APPLICATION_DROP_DOWN.getValue())).click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(app.getValue())));
        driver1.findElement(By.id(app.getValue())).click();
        waitUntilWaitForServerDissappears(wait);
    }
}

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

private static boolean isApplicationAlreadySelected(WebDriver driver1, applications app) {
    return app.getValue().toLowerCase()
            .contains(driver1.findElement(By.id("appTitle")).getText().toLowerCase());
}

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

public static void enterCredentials(WebDriver driver, String username, String password) throws IOException {

    logger.info("Entering credentials and pressing on login (username= " + username + ", password= " + password
            + ")");
    driver.findElement(By.id(applangoTextfields.MAIN_LoginUsername.getValue().toString())).clear();
    driver.findElement(By.id(applangoTextfields.MAIN_LoginUsername.getValue().toString())).sendKeys(username);
    driver.findElement(By.id(applangoTextfields.MAIN_LoginPassword.getValue().toString())).clear();
    driver.findElement(By.id(applangoTextfields.MAIN_LoginPassword.getValue())).sendKeys(password);
}

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

public static void waitForDashboardLoginPageToLoad(WebDriverWait wait) throws IOException {
    wait.until(ExpectedConditions//from ww  w .  ja  v a  2 s .c o  m
            .visibilityOfAllElementsLocatedBy(By.id(applangoButtons.LOGIN_SUBMIT.getValue().toString())));
}