Example usage for org.openqa.selenium WebElement click

List of usage examples for org.openqa.selenium WebElement click

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement click.

Prototype

void click();

Source Link

Document

Click this element.

Usage

From source file:com.ecofactor.qa.automation.insite.page.DemandSideManagementImpl.java

License:Open Source License

/**
 * Gets the next program button.//  w  w w  .j  ava2  s. c o  m
 * 
 * @return the next program button
 */
private boolean getNextProgramButton() {

    DriverConfig.setLogString("click next page element.", true);
    boolean nextpageFound = false;
    WebElement paginationBottom = formElement
            .findElement(By.id(demandSideManagementConfig.get(PROGRAM_PAGINATION_BOTTOM_ELEMENT)));

    List<WebElement> pageLists = paginationBottom.findElements(By.tagName(TAG_SPAN));

    WebElement nextpage = pageLists.get(8);
    String classDisplayed = nextpage.getAttribute("class");
    logger.info(DISABLED_CLASS + " : nextpage.getAttribute(class): " + classDisplayed, true);
    nextpageFound = classDisplayed.endsWith(demandSideManagementConfig.get(DISABLED_CLASS)) ? true : false;

    if (nextpageFound == false) {
        logger.info(nextpage.isEnabled() + "next page found!");
        nextpage.click();
        DriverConfig.setLogString("next page clicked!", true);
    }
    return !nextpageFound;
}

From source file:com.ecofactor.qa.automation.insite.page.ECPCoreManagementImpl.java

License:Open Source License

/**
 * @see com.ecofactor.qa.automation.insite.page.ECPCoreManagement#clickSave()
 *///w w  w. j a  v a2  s .c  o m
@Override
public void clickSave() {

    DriverConfig.setLogString("Click save link.", true);
    WebElement saveLink = retrieveElementByTagText(DriverConfig.getDriver(), TAG_ANCHOR, "Save");
    saveLink.click();

    tinyWait();

}

From source file:com.ecofactor.qa.automation.insite.page.ECPCoreManagementImpl.java

License:Open Source License

/**
 * @see com.ecofactor.qa.automation.insite.page.ECPCoreManagement#clickCancel()
 *///from  w  w  w  .j a v a  2 s  .  c  o  m
@Override
public void clickCancel() {

    DriverConfig.setLogString("Click Cancel in Ecp Page ", true);
    WaitUtil.smallWait();
    final WebElement cancelLink = retrieveElementByTagText(DriverConfig.getDriver(), TAG_ANCHOR, "Cancel");
    cancelLink.click();

}

From source file:com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPageImpl.java

License:Open Source License

/**
 * Click admin.//w  ww  . j a va 2 s  .  c  o m
 * @see com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPage#clickAdmin()
 */
@Override
public void clickUserManagement() {

    DriverConfig.setLogString("select user management page.", true);
    selectPage(ADMIN);
    smallWait();
    subMenu = DriverConfig.getDriver().findElement(By.id("submenu"));

    WebElement rolesLink = retrieveSubElementByTagText(DriverConfig.getDriver(), subMenu, "a",
            insiteConfig.get(USER_MNGMNT), SHORT_TIMEOUT);
    rolesLink.click();
    smallWait();

    logger.info("check if user management page is displayed.");
    String url = insiteConfig.get(ADMIN_PAGE).split("\\?")[0];
    logger.info(DriverConfig.getDriver().getCurrentUrl() + " check if user management page is selected." + url);
    Assert.assertTrue(DriverConfig.getDriver().getCurrentUrl().contains(url), "Url is different");

}

From source file:com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPageImpl.java

License:Open Source License

/**
 * Click role management./*from   w  w  w .ja v  a  2  s.  c o m*/
 * @see com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPage#clickRoleManagement()
 */
@Override
public void clickRoleManagement() {

    DriverConfig.setLogString("select role management page.", true);
    if (!DriverConfig.getDriver().getCurrentUrl().contains(insiteConfig.get(ADMIN_PAGE)))
        selectPage(ADMIN);
    smallWait();

    subMenu = DriverConfig.getDriver().findElement(By.id("submenu"));

    WebElement rolesLink = retrieveSubElementByTagText(DriverConfig.getDriver(), subMenu, "a",
            insiteConfig.get(ROLE_MNGMNT), SHORT_TIMEOUT);
    rolesLink.click();
    smallWait();

    logger.info("check if role management page is displayed.");
    String url = insiteConfig.get(ROLE_PAGE).split("\\?")[0];
    logger.info(DriverConfig.getDriver().getCurrentUrl() + " check if role management page is selected." + url);
    Assert.assertTrue(DriverConfig.getDriver().getCurrentUrl().contains(url), "Url is different");
}

From source file:com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPageImpl.java

License:Open Source License

/**
 * Click upload one user.//from   w  ww.  j  a v a2  s  .c  o  m
 * @see com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPage#clickUploadOneUser()
 */
@Override
public void clickUploadOneUser() {

    DriverConfig.setLogString("select upload one user page.", true);
    selectPage(ON_BOARDING);
    WaitUtil.waitUntil(SHORT_TIMEOUT);

    subMenu = DriverConfig.getDriver().findElement(By.id("submenu"));

    WebElement errorToBeFixedLink = retrieveSubElementByTagText(DriverConfig.getDriver(), subMenu, "a",
            insiteConfig.get(UPLOAD_ONE_USER), SHORT_TIMEOUT);
    errorToBeFixedLink.click();
    WaitUtil.waitUntil(SHORT_TIMEOUT);

    logger.info("check if on baording- upload one user page is displayed.");
    String url = insiteConfig.get(UPLOAD_ONE_USER).split("\\?")[0];
    logger.info(DriverConfig.getDriver().getCurrentUrl() + " check if upload one user page is selected." + url);
    // Assert.assertTrue(driver.getCurrentUrl().contains(url),
    // "Url is different");
}

From source file:com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPageImpl.java

License:Open Source License

/**
 * Click bulk upload./*from  ww w .  java  2  s .  c o  m*/
 * @see com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPage#clickBulkUpload()
 */
@Override
public void clickBulkUpload() {

    DriverConfig.setLogString("select On boarding - BULK UPLOAD page.", true);
    selectPage(ON_BOARDING);
    WaitUtil.waitUntil(SHORT_TIMEOUT);
    logger.info("On boarding selected.");
    subMenu = DriverConfig.getDriver().findElement(By.id("submenu"));
    WebElement bulkUploadLink = retrieveSubElementByTagText(DriverConfig.getDriver(), subMenu, "a",
            insiteConfig.get(BULK_UPLOADS), SHORT_TIMEOUT);
    bulkUploadLink.click();

    logger.info("check if on baording- BULK UPLOAD page is displayed.");
    String url = insiteConfig.get(ON_BOARD_PAGE).split("\\?")[0];
    logger.info(DriverConfig.getDriver().getCurrentUrl()
            + " check if on baording- BULK UPLOAD page is selected." + url);
    Assert.assertTrue(DriverConfig.getDriver().getCurrentUrl().contains(url), "Url is different");
}

From source file:com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPageImpl.java

License:Open Source License

/**
 * Click history./*from  ww w .  ja  va 2 s  .co  m*/
 * @see com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPage#clickHistory()
 */
@Override
public void clickHistory() {

    DriverConfig.setLogString("select On boarding - history page.", true);
    selectPage(ON_BOARDING);
    WaitUtil.waitUntil(SHORT_TIMEOUT);

    subMenu = DriverConfig.getDriver().findElement(By.id("submenu"));

    WebElement historyLink = retrieveSubElementByTagText(DriverConfig.getDriver(), subMenu, "a",
            insiteConfig.get(HISTORY), SHORT_TIMEOUT);
    historyLink.click();
    WaitUtil.waitUntil(SHORT_TIMEOUT);

    logger.info("check if on baording- history is displayed.");
    String url = insiteConfig.get(HISTORY_PAGE).split("\\?")[0];
    logger.info(
            DriverConfig.getDriver().getCurrentUrl() + " check if baording- history page is selected." + url);
    Assert.assertTrue(DriverConfig.getDriver().getCurrentUrl().contains(url), "Url is different");
}

From source file:com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPageImpl.java

License:Open Source License

/**
 * Click errors to be fixed.//from  www  .  j  a  v  a  2  s.c  o  m
 * @see com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPage#clickErrorsToBeFixed()
 */
@Override
public void clickErrorsToBeFixed() {

    DriverConfig.setLogString("select On boarding - errors to be fixed page.", true);
    selectPage(ON_BOARDING);
    WaitUtil.waitUntil(SHORT_TIMEOUT);

    subMenu = DriverConfig.getDriver().findElement(By.id("submenu"));

    WebElement errorToBeFixedLink = retrieveSubElementByTagText(DriverConfig.getDriver(), subMenu, "a",
            insiteConfig.get(ERRORS_TO_BE_FIXED), SHORT_TIMEOUT);
    errorToBeFixedLink.click();
    WaitUtil.waitUntil(SHORT_TIMEOUT);

    logger.info("check if on baording- Errors to be fixed page is displayed.");
    String url = insiteConfig.get(ERRORS_TO_BE_FIXED_PAGE).split("\\?")[0];
    logger.info(DriverConfig.getDriver().getCurrentUrl()
            + " check if on baording- Errors to be fixed page is selected." + url);
    Assert.assertTrue(DriverConfig.getDriver().getCurrentUrl().contains(url), "Url is different");
}

From source file:com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPageImpl.java

License:Open Source License

/**
 * Click partner management./*w  w  w.j a va2  s .  co m*/
 * @see com.ecofactor.qa.automation.insite.page.InsiteAuthenticatedPage#clickAdmin()
 */
@Override
public void clickPartnerManagement() {

    DriverConfig.setLogString("select partner management page.", true);
    selectPage(ADMIN);
    smallWait();
    subMenu = DriverConfig.getDriver().findElement(By.id("submenu"));

    WebElement rolesLink = retrieveSubElementByTagText(DriverConfig.getDriver(), subMenu, "a",
            insiteConfig.get(PARTNER_MNGMNT), SHORT_TIMEOUT);
    rolesLink.click();
    smallWait();

    logger.info("check if partner management page is displayed.");
    String url = insiteConfig.get(ADMIN_PAGE).split("\\?")[0];
    logger.info(
            DriverConfig.getDriver().getCurrentUrl() + " check if partner management page is selected." + url);
    /*
     * Assert.assertTrue(DriverConfig.getDriver().getCurrentUrl().contains(url ),
     * "Url is different");
     */
}