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.liferay.faces.test.selenium.browser.internal.WaitingAsserterImpl.java

License:Open Source License

@Override
public void assertElementNotDisplayed(String elementXpath) {
    assertTrue(ExpectedConditions.invisibilityOfElementLocated(By.xpath(elementXpath)));
}

From source file:com.novartis.opensource.yada.test.YADAAdminTest.java

License:Apache License

/**
 * Test App Manager new query for new app then cancel
 * @throws InterruptedException if any thread has interrupted the current thread
 *///from   www.  j  a  v  a  2s . co  m
@Test(dependsOnMethods = { "testAppCreation" })
public void testNewQueryForNewAppCancel() throws InterruptedException {
    WebDriver d = getDriver();
    this.createQueryForNewApp("Test Cancel", "cancel");

    new WebDriverWait(d, 20)
            .until(ExpectedConditions.invisibilityOfElementLocated(By.id("query-editor-container")));
    Assert.assertEquals(d.findElements(By.cssSelector("#query-table tbody td.dataTables_empty")).size(), 1);
}

From source file:com.zutubi.pulse.acceptance.SeleniumBrowser.java

License:Apache License

public void waitForElementToDisappear(final By by) {
    Wait<WebDriver> wait = new WebDriverWait(webDriver, WAITFOR_TIMEOUT / 1000, WAITFOR_INTERVAL)
            .ignoring(RuntimeException.class);
    wait.until(ExpectedConditions.invisibilityOfElementLocated(by));
}

From source file:common.KeywordBase.java

License:Apache License

/**
 * Wait until element is invisible//from  w  ww .ja  v  a2 s .  co m
 * 
 * @param locator
 *            HTML element locator from Object Repository file.
 */
public synchronized void waitForElementInvisible(final String locator) {
    wait.until(ExpectedConditions.invisibilityOfElementLocated(getElementBy(locator)));
}

From source file:de.tntinteractive.portalsammler.sources.IngDibaSourceV1.java

License:Open Source License

@Override
public Pair<Integer, Integer> poll(final SourceSettings settings, final UserInteraction gui,
        final SecureStore store) throws Exception {
    final WebDriver driver = this.createDriver("https://banking.ing-diba.de/app/login");

    final WebElement userField = driver.findElement(By.name("view:kontonummer:border:border_body:kontonummer"));
    userField.sendKeys(settings.get(USER, gui));

    final WebElement passwordField = driver.findElement(By.name("view:pin:border:border_body:pin"));
    passwordField.sendKeys(settings.get(PASSWORD, gui));

    passwordField.submit();//from  w  w  w  . j  a  va 2s  .  c  o  m

    waitForPresence(driver, By.className("dbkpBoard"));

    final List<Integer> missingValues = new ArrayList<Integer>();
    for (final WebElement possibleKeyInput : driver.findElements(By.tagName("input"))) {
        final String missingValuePrefix = "view:key:border:border_body:key:dbkpDisplayDiv:values:";
        final String name = possibleKeyInput.getAttribute("name");
        if (startsWith(name, missingValuePrefix)) {
            final String s = name.substring(missingValuePrefix.length(), missingValuePrefix.length() + 1);
            missingValues.add(Integer.parseInt(s));
        }
    }

    final String code = settings.get(CODE, gui);

    for (final Integer missing : missingValues) {
        final String number = Character.toString(code.charAt(missing));
        clickButton(driver, number);
    }

    clickButton(driver, "Anmelden");

    waitForPresence(driver, By.partialLinkText("Post-Box"));
    clickLink(driver, "Post-Box");

    (new WebDriverWait(driver, WAIT_TIME))
            .until(ExpectedConditions.invisibilityOfElementLocated(By.id("busy")));

    int newDocs = 0;
    int knownDocs = 0;
    try {
        final FileDownloader d = new FileDownloader(driver);
        for (final WebElement row : driver.findElements(By.tagName("tbody"))) {
            final DocumentInfo metadata = DocumentInfo.create(this.getId(), DocumentFormat.PDF);

            for (final WebElement cell : row.findElements(By.tagName("td"))) {
                final String text = cell.getText();
                if (this.isDate(text)) {
                    metadata.setDate(parseDate(text));
                } else {
                    metadata.addKeywords(text);
                }
            }

            if (!store.containsDocument(metadata)) {
                final WebElement link = row.findElement(By.tagName("a"));
                final byte[] file = d.downloadFile(link);
                store.storeDocument(metadata, file);
                newDocs++;
            } else {
                knownDocs++;
            }
        }

    } finally {
        clickLink(driver, "Log-out");
    }
    return Pair.of(newDocs, knownDocs);
}

From source file:fi.foyt.fni.test.ui.base.gamelibrary.GameLibraryListTestsBase.java

License:Creative Commons License

private void assertShareButtonsHidden(String publicationSelector) {
    new WebDriverWait(getWebDriver(), 10).until(ExpectedConditions.invisibilityOfElementLocated(
            By.cssSelector(publicationSelector + " .gamelibrary-publication-share-button .entypo-twitter")));
    assertSelectorNotVisible(/*from   w w w  .  j  a  v a  2  s .  c o  m*/
            String.format("%s .gamelibrary-publication-share-button .entypo-twitter", publicationSelector));
    assertSelectorNotVisible(
            String.format("%s .gamelibrary-publication-share-button .entypo-facebook", publicationSelector));
    assertSelectorNotVisible(
            String.format("%s .gamelibrary-publication-share-button .entypo-gplus", publicationSelector));
}

From source file:io.ddavison.conductor.Locomotive.java

License:Open Source License

public Locomotive click(By by) {
    waitForCondition(ExpectedConditions.not(ExpectedConditions.invisibilityOfElementLocated(by)))
            .waitForCondition(ExpectedConditions.elementToBeClickable(by));
    waitForElement(by).click();/*from   w ww.  j a v a2s .  c om*/
    return this;
}

From source file:io.ddavison.conductor.Locomotive.java

License:Open Source License

public Locomotive setText(By by, String text) {
    waitForCondition(ExpectedConditions.not(ExpectedConditions.invisibilityOfElementLocated(by)))
            .waitForCondition(ExpectedConditions.elementToBeClickable(by));
    WebElement element = waitForElement(by);
    element.clear();/*from w ww.  j  ava  2s. c o m*/
    element.sendKeys(text);
    waitForCondition(ExpectedConditions.or(ExpectedConditions.textToBe(by, text),
            ExpectedConditions.attributeToBe(by, "value", text)));
    return this;
}

From source file:io.ddavison.conductor.Locomotive.java

License:Open Source License

public Locomotive check(By by) {
    if (!isChecked(by)) {
        waitForCondition(ExpectedConditions.not(ExpectedConditions.invisibilityOfElementLocated(by)))
                .waitForCondition(ExpectedConditions.elementToBeClickable(by));
        waitForElement(by).click();//from  w  ww .  ja v a2s  . c om
        assertTrue(by.toString() + " did not check!", isChecked(by));
    }
    return this;
}

From source file:io.ddavison.conductor.Locomotive.java

License:Open Source License

public Locomotive uncheck(By by) {
    if (isChecked(by)) {
        waitForCondition(ExpectedConditions.not(ExpectedConditions.invisibilityOfElementLocated(by)))
                .waitForCondition(ExpectedConditions.elementToBeClickable(by));
        waitForElement(by).click();//from   w w  w. j a va2  s .  c  om
        assertFalse(by.toString() + " did not uncheck!", isChecked(by));
    }
    return this;
}