Example usage for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated.

Prototype

public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator) 

Source Link

Document

An expectation for checking that an element is present on the DOM of a page and visible.

Usage

From source file:com.denimgroup.threadfix.selenium.pages.ApplicationDetailPage.java

License:Mozilla Public License

public ApplicationDetailPage clickEditWaf() {
    driver.findElementById("editWafButton").click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("addWaf")));
    return new ApplicationDetailPage(driver);
}

From source file:com.denimgroup.threadfix.selenium.pages.ApplicationDetailPage.java

License:Mozilla Public License

public ApplicationDetailPage clickAddWaf() {
    driver.findElementById("addWafButton").click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("addWafForm")));
    return new ApplicationDetailPage(driver);
}

From source file:com.dhenton9000.selenium.generic.WaitMethods.java

public void waitForExpectedElement(int timeInSeconds, SELECTOR_CHOICE selectorChoice, String selectorValue) {

    WebDriverWait wait = new WebDriverWait(driver, timeInSeconds);
    By selectionBy = generateSelectorBy(selectorChoice, selectorValue);
    wait.until(ExpectedConditions.visibilityOfElementLocated(selectionBy));

}

From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java

protected void movetoBillsReloads() throws InterruptedException {
    boolean breakIt;
    while (true) {
        breakIt = true;/*from   w  ww . j  a  va2  s .c  o m*/
        try {
            waitForPageLoad(60);
            handleLink_ByText("MyDigi");
            waitForPageLoad(30);
            waitgetForPageLoad(30).until(ExpectedConditions
                    .visibilityOfElementLocated(By.xpath("//*[@id='content']/div[13]/div/div")));

            getDriver().findElement(By.xpath("//*[@id='content']/div[13]/div/div/div[2]/button[1]")).click();
            Thread.sleep(4000);
            handleLink_ByText("Bills & Reloads");
        } catch (Exception e) {
            e.printStackTrace();
            breakIt = false;
        }
        if (breakIt) {
            break;
        }
    }
}

From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java

protected void targetAccountIdName() {
    try {/*from  w w w.  j  av  a2s.c o  m*/
        waitgetForPageLoad(30)
                .until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='plan-name']")));
        //String expectedAccountIdName = "Phoenix Project 413701757";
        actualAccountIdName = getWebElement_By_xpath("//*[@id='accountIdName']").getText();

        //System.out.println("Plan ID : "+ actualPlanId);
    } catch (Exception e) {
        log.error("Fail : To validate the target Account ID name");
    }
}

From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java

protected void targetplanName() {
    try {/*from w  w w .  j a v  a  2 s  .c  om*/

        waitgetForPageLoad(30)
                .until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='plan-name']/strong")));
        String expectedPlanName = "Phoenix Project";
        actualPlanName = getWebElement_By_xpath("//*[@id='plan-name']/strong").getText();
        //System.out.println("Plan Name : "+ actualPlanName);
    } catch (Exception e) {
        log.error("Fail : To validate the target plan name");
    }

}

From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java

protected void targetplanId() {

    try {//from w  ww.  ja  va 2 s.c  o  m
        waitgetForPageLoad(30)
                .until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='plan-detail']")));
        //String expectedPlanId = "413701757";
        actualPlanId = getWebElement_By_xpath("//*[@id='plan-detail']").getText();

        //System.out.println("Plan ID : "+ actualPlanId);
    } catch (Exception e) {
        log.error("Fail : To validate the target plan ID");
    }
}

From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java

protected void targetTotalReload() {
    try {/*  www  . ja v  a2s.  c o  m*/
        JavascriptExecutor jse = (JavascriptExecutor) getDriver();
        jse.executeScript("window.scrollBy(0,300)", "");
        waitgetForPageLoad(30).until(ExpectedConditions
                .visibilityOfElementLocated(By.xpath("//*[@id='content']/div[9]/div[2]/div/div[1]/div[2]/p")));
        //String expectedTotalReload = "RM 0.00";
        //*[@id="content"]/div[9]/div[2]/div/div[1]/div[2]/p
        actualTotalReload = getWebElement_By_xpath("//*[@id='content']/div[9]/div[2]/div/div[1]/div[2]/p")
                .getText();
        System.out.println("actualTotalReload : " + actualTotalReload);
        jse.executeScript("window.scrollBy(0,-300)", "");
    } catch (Exception e) {
        log.error("Fail : To validate the target Total Reload");
    }

}

From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java

protected void targetFinalAmt() {
    try {//w  ww. j  a va 2s  .c o  m
        //*[@id='content']/div/div/div[1]/div[9]/div[2]/strong
        WebDriverWait wait = new WebDriverWait(getDriver(), 20);
        wait.until(ExpectedConditions.visibilityOfElementLocated(
                By.xpath("//*[@id='content']/div/div/div[1]/div[9]/div[2]/strong")));
        WebElement amt = getDriver()
                .findElement(By.xpath("//*[@id='content']/div/div/div[1]/div[9]/div[2]/strong"));
        finalamt = amt.getText();
    } catch (Exception e) {
        log.error("Fail : To validate the targetAir time amount on Payment Page");
    }
}

From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java

protected void targetYAxisData(int index) {

    JavascriptExecutor jse = (JavascriptExecutor) getDriver();
    jse.executeScript("window.scrollBy(0,-800)", "");

    getWebElement_By_xpath("//*[@id='content']/div[9]/div[1]/div[2]/ul/li[" + index + "]/a").click();
    Wait<WebDriver> wait = new WebDriverWait(getDriver(), 30);

    if (index == 1)
        jse.executeScript("window.scrollBy(0,210)", "");
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//*[name()='svg']/*[name()='g'][13]/*[name()='g'][2]")));
    //Working :get the stroke attribute to get the color value of graph
    getDriver().manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    boolean breakIt = true;

    //Get the BillCycle Elements
    String yaxisrootNodeXpath = "//*[name()='svg']/*[name()='g'][13]/*[name()='g'][2]";
    WebElement yaxisrootElement = getDriver().findElement(By.xpath(yaxisrootNodeXpath));
    String yaxischildXpath = "./*[name()='text']";
    listyaxischild = yaxisrootElement.findElements(By.xpath(yaxischildXpath));
    int eleListSize = listyaxischild.size();
    // String targetrootdatapath= "//*[@id='content']/div[9]/div[1]/div[1]/div[2]/div/div/svg/g[13]/g[2]";
    if (index == 1)
        System.out.println("===========30 Days Y-AxisData========");
    else {//from  ww w. j a v a2 s  . c o  m
        if (index == 2)
            System.out.println("===========60 Days Y-AxisData========");
        else
            System.out.println("===========90 Days Y-AxisData========");
    }
}