Example usage for org.openqa.selenium ElementNotVisibleException ElementNotVisibleException

List of usage examples for org.openqa.selenium ElementNotVisibleException ElementNotVisibleException

Introduction

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

Prototype

public ElementNotVisibleException(String message) 

Source Link

Usage

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void waitForElementFound(String guiElementDescription, int timeoutInSeconds) {
    String msg = "Wait %ss for [%s] on page [%s]";
    log.debug(String.format(msg, timeoutInSeconds, guiElementDescription, this.getClass()));
    try {//from   www  . jav a  2  s . c  om
        WebElement e = (new WebDriverWait(webDriver, timeoutInSeconds))
                .until(ExpectedConditions.presenceOfElementLocated(getSelector(guiElementDescription)));
        log.debug("DEBUG: Element found");
        if (e != null) {
            return;
        } else {
            throw new ElementNotVisibleException(guiElementDescription + " did not load.");
        }
    } catch (TimeoutException toe) {
        throw new ElementNotVisibleException(
                guiElementDescription + " did not load with TimeoutException " + toe.getMessage());
    }
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void waitForElementHidden(String guiElementDescription, int timeoutInSeconds) {
    String msg = "Wait %ss for [%s] on page [%s]";
    log.debug(String.format(msg, timeoutInSeconds, guiElementDescription, this.getClass().getSimpleName()));
    boolean visible = true;
    for (int i = 0; i < timeoutInSeconds; i++) {
        visible = isVisible(guiElementDescription);
        if (!visible) {
            return;
        }/* ww w  .  j  av a 2 s .c  om*/
        delay(1);
    }
    throw new ElementNotVisibleException(guiElementDescription + " is still visible on the Web Page. ");
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void waitForElementNotFound(String guiElementDescription, int timeoutInSeconds) {
    String msg = "Wait %ss for [%s] on page [%s]";
    log.debug(String.format(msg, timeoutInSeconds, guiElementDescription, this.getClass().getSimpleName()));
    try {// ww  w. j ava 2s.  c om
        Boolean e = (new WebDriverWait(webDriver, timeoutInSeconds))
                .until(ExpectedConditions.invisibilityOfElementLocated(getSelector(guiElementDescription)));
        log.debug("Element found");
        if (e == true) {
            return;
        } else {
            throw new ElementNotVisibleException(guiElementDescription + " is still on the page.");
        }
    } catch (TimeoutException toe) {
        return;
    } catch (WebDriverException e) {
        return;
    }
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void waitForElementVisible(String guiElementDescription, int timeoutInSeconds) {
    String msg = "Wait %ss for [%s] on page [%s]";
    log.debug("waitForElementVisible should time out in " + timeoutInSeconds);
    log.debug(String.format(msg, timeoutInSeconds, guiElementDescription, this.getClass().getSimpleName()));
    WebElement e = (new WebDriverWait(webDriver, timeoutInSeconds))
            .until(ExpectedConditions.visibilityOfElementLocated(getSelector(guiElementDescription)));
    log.debug("Element found");
    if (e != null) {
        return;/*  w  w  w .  j  a v  a 2 s .  co  m*/
    } else {
        throw new ElementNotVisibleException(guiElementDescription + " did not become visible.");
    }
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void waitForElementVisible(WebElement locator, int timeoutInSeconds) throws ElementNotVisibleException {
    WebElement e = null;/*from w  w w . jav a2s  .c  om*/
    log.debug("Wait for Element Visible should time out in " + timeoutInSeconds);
    e = (new WebDriverWait(webDriver, timeoutInSeconds)).until(ExpectedConditions.visibilityOf(locator));
    log.debug("end wait for Element Visible");
    if (e != null) {
        return;
    } else {
        throw new ElementNotVisibleException(locator.getTagName() + " did not become visible.");
    }
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void waitForElementClickable(String guiElementDescription, int timeoutInSeconds)
        throws ElementNotVisibleException {
    WebElement e = null;//from  www  . j  a  v a2  s.co  m
    log.debug("Wait for Element Visible should time out in " + timeoutInSeconds);
    e = (new WebDriverWait(webDriver, timeoutInSeconds))
            .until(ExpectedConditions.elementToBeClickable(getSelector(guiElementDescription)));
    log.debug("end wait for Element Visible");
    if (e != null) {
        return;
    } else {
        throw new ElementNotVisibleException(guiElementDescription + " did not become visible.");
    }
}

From source file:com.github.seleniumpm.pagemodel.webelements.Element.java

License:Apache License

public Element visible() throws ElementNotVisibleException {
    if (!sel.isVisible(locator))
        throw new ElementNotVisibleException("locator='" + locator + "' was not visible!");
    return this;
}

From source file:com.github.seleniumpm.webelements.Element.java

License:Apache License

public Element visible() throws ElementNotVisibleException {
    if (!isVisible())
        throw new ElementNotVisibleException("locator='" + locator + "' was not visible!");
    return this;
}

From source file:com.google.android.testing.nativedriver.server.ViewElement.java

License:Apache License

private void waitUntilIsDisplayed() {
    AndroidWait wait = newAndroidWait();
    // TODO(dxu): determine the proper timeout and call
    // wait.setTimeoutInMillis(timeoutInMillis), default 1000ms in AndroidWait
    try {/*w  ww  . j a va2s.c o  m*/
        wait.until(new Function<Void, Boolean>() {
            @Override
            public Boolean apply(Void input) {
                return isDisplayed();
            }
        });
    } catch (TimeoutException exception) {
        throw new ElementNotVisibleException("You may only do passive read with element not displayed");
    }
}

From source file:com.machinepublishers.jbrowserdriver.ElementServer.java

License:Apache License

private void validate(boolean mustBeVisible) {
    validate(node, contextItem);//from  w  ww .  ja va 2  s .co  m
    if (mustBeVisible && !isDisplayed()) {
        throw new ElementNotVisibleException("Element is not visible.");
    }
}