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

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

Introduction

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

Prototype

public static ExpectedCondition<Boolean> invisibilityOfElementLocated(final By locator) 

Source Link

Document

An expectation for checking that an element is either invisible or not present on the DOM.

Usage

From source file:com.coderoad.automation.common.util.PageUtil.java

License:Open Source License

/**
 * Checks if is not displayed.//  ww w.  j  av  a  2  s  .  co  m
 * 
 * @param driver the driver
 * @param locator the locator
 * @param timeout the timeout
 * @return true, if is not displayed
 */
public static boolean isNotDisplayed(final WebDriver driver, final By locator, final Timeout timeout) {

    try {
        return new WebDriverWait(driver, timeout.getValue())
                .until(ExpectedConditions.invisibilityOfElementLocated(locator));
    } catch (Exception ex) {
        return true;
    }
}

From source file:com.cognifide.qa.bb.aem.dialog.classic.field.image.AemImage.java

License:Apache License

/**
 * Drags image from content finder to image dialog's drop area.
 *
 * @param element WebElement representing image from content finder.
 * @return This instance./*from  w w  w  .  j a  v  a  2  s.  c  om*/
 */
public AemImage insert(Draggable element) {
    Droppable dropabble = factory.createDroppable(dropArea, framePath);
    element.dropTo(dropabble);
    bobcatWait.withTimeout(Timeouts.MEDIUM)
            .until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(DROP_AN_IMAGE_XPATH)));
    return this;
}

From source file:com.cognifide.qa.bb.aem.ui.AemContentFinder.java

License:Apache License

/**
 * Resizes contentFinder. If widthInPixels is lower or equal 0 then collapse() method is invoked.
 * It may be useful to select tab on icon bar. In Selenium only visible elements are clickable, so
 * sometimes user has to resize contentFinder before clicking the tab.
 *
 * @param widthInPixels new width/*from  w w w  .  ja  v a 2  s . c om*/
 * @return This AemContentFinder instance.
 */
public AemContentFinder resize(int widthInPixels) {
    if (widthInPixels <= 0) {
        collapse();
    } else {
        if (isCollapsed()) {
            expand();
        }
        Draggable dragable = factory.createDraggable(resizerDiv, framePath);
        dragable.dropByOffset(widthInPixels - getCurrentWidth(), 0);

        bobcatWait.withTimeout(Timeouts.MEDIUM)
                .until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(SHOWN_DURING_MOUSE_DRAG_DIV)));
    }
    return this;
}

From source file:com.consol.citrus.selenium.client.WebClient.java

License:Apache License

/**
 * Wait until an item is loaded./* w  ww. ja  v a  2s. com*/
 *
 * @param by Element to wait for to be hidden.
 * @param sec Timeout
 * @return true when the element is invisible.
 */
public boolean waitUntilHidden(By by, long sec) {
    WebDriverWait q = new WebDriverWait(webDriver, sec);
    q.until(ExpectedConditions.invisibilityOfElementLocated(by));

    return !findElement(by).isDisplayed();
}

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

License:Mozilla Public License

public ApplicationDetailPage addManualFinding(Boolean stat, String cwe, String url, String sourceFile,
        String lineNum, String Parameter, String Severity, String description) {
    driver.findElementById("addManualFindinModalLink").click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("addManualFinding")));
    if (stat) {/*from w  w  w.j  a  v  a 2  s . c  om*/
        driver.findElementById("staticRadioButton").click();
    }
    driver.findElementById("txtSearch").sendKeys(cwe);
    driver.findElementById("urlDynamicSearch").sendKeys(url);
    driver.findElementById("urlStaticSearch").sendKeys(sourceFile);
    driver.findElementById("urlSearch").sendKeys(lineNum);
    driver.findElementById("parameterInput").sendKeys(Parameter);
    new Select(driver.findElementById("severityInput")).selectByVisibleText(Severity);
    driver.findElementById("descriptionInput").sendKeys(description);
    driver.findElementById("submitDTModal").click();
    wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("addManualFinding")));
    return new ApplicationDetailPage(driver);
}

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

License:Mozilla Public License

public ApplicationDetailPage clickCloseManualFindingButton() {
    driver.findElementById("closeManualFindingModalButton").click();
    wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("closeManualFindingModalButton")));
    return new ApplicationDetailPage(driver);
}

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

License:Mozilla Public License

public void waitForInvisibleElement(WebElement e) {
    WebDriverWait wait = new WebDriverWait(driver, 10);
    wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id(e.getAttribute("id"))));
}

From source file:com.ecofactor.qa.automation.util.PageUtil.java

License:Open Source License

/**
 * Utility to check weather the particular field is displayed or not.
 * @param driver the driver/* w w  w. j av  a 2s  .c  o m*/
 * @param fieldname the fieldname
 * @param timeOut the time out
 * @return boolean
 */
public static boolean isNotDisplayedById(final WebDriver driver, final String fieldname, int timeOut) {

    boolean isLoaded = false;
    isLoaded = (new WebDriverWait(driver, timeOut))
            .until(ExpectedConditions.invisibilityOfElementLocated(By.id(fieldname)));

    return isLoaded;
}

From source file:com.elastica.webelements.BasePage.java

License:Apache License

public void waitForElementToDisappear(final HtmlElement element) {
    Assert.assertNotNull(element, "Element can't be null");
    TestLogging.logWebStep(null, "wait for " + element.toString() + " to disappear.", false);

    WebDriverWait wait = new WebDriverWait(driver, explictWaitTimeout);
    wait.until(ExpectedConditions.invisibilityOfElementLocated(element.getBy()));
}

From source file:com.formkiq.web.FolderIntegrationTest.java

License:Apache License

/**
 * testAddFolder02()./*from  ww  w. java 2 s .  c  o m*/
 * add folder
 *
 * @throws Exception Exception
 */
@Test
public void testAddFolder02() throws Exception {
    // given
    String folder = "testfolder";

    // when
    findElementBy(By.id("folder_add_button")).click();

    getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("form-modal")));

    findElementBy("input", "data-valuekey", "name").sendKeys(folder);
    WebElement el = findElementBy(By.name("_eventId_next"));
    assertEquals("Add Folder", el.getText());
    el.click();

    // then
    getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("form-modal")));

    int i = 0;
    final int elementCount = 2;
    List<WebElement> e = findElements(By.xpath("//table[@id='results']/tbody/tr/td"));
    assertEquals(elementCount, e.size());
    assertEquals("testfolder", e.get(i++).getText());
    assertEquals("", e.get(i++).getText());

    // when
    findElementBy(By.id("tablesearch")).sendKeys("testf1");
    findElementBy(By.id("buttonsearch")).click();

    // then
    e = findElements(By.xpath("//table[@id='results']/tbody/tr"));
    assertEquals(1, e.size());
    assertEquals("No Folder(s) found", e.get(0).getText());

    // when
    findElementBy(By.id("tablesearch")).clear();
    findElementBy(By.id("tablesearch")).sendKeys("testf");
    findElementBy(By.id("buttonsearch")).click();

    // then
    e = findElements(By.xpath("//table[@id='results']/tbody/tr"));
    assertEquals(1, e.size());
    assertEquals("testfolder", e.get(0).getText());
}