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

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

Introduction

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

Prototype

public static ExpectedCondition<Boolean> not(final ExpectedCondition<?> condition) 

Source Link

Document

An expectation with the logical opposite condition of the given condition.

Usage

From source file:io.openvidu.test.e2e.OpenViduTestAppE2eTest.java

License:Apache License

@Test
@DisplayName("Publish Unpublish")
void publishUnpublishTest() throws Exception {

    setupBrowser("chrome");

    log.info("Signal message");

    user.getDriver().findElement(By.id("auto-join-checkbox")).click();
    user.getDriver().findElement(By.id("one2one-btn")).click();

    user.getEventManager().waitUntilEventReaches("connectionCreated", 4);
    user.getEventManager().waitUntilEventReaches("accessAllowed", 2);
    user.getEventManager().waitUntilEventReaches("streamCreated", 4);
    user.getEventManager().waitUntilEventReaches("streamPlaying", 4);

    int numberOfVideos = user.getDriver().findElements(By.tagName("video")).size();
    Assert.assertEquals("Expected 4 videos but found " + numberOfVideos, 4, numberOfVideos);
    Assert.assertTrue("Videos were expected to have audio and video tracks", user.getEventManager()
            .assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));

    List<WebElement> publishButtons = user.getDriver().findElements(By.className("pub-btn"));
    for (WebElement el : publishButtons) {
        el.click();//w  w w .j a va 2s.  co m
    }

    user.getEventManager().waitUntilEventReaches("streamDestroyed", 4);
    for (WebElement video : user.getDriver().findElements(By.tagName("video"))) {
        user.getWaiter()
                .until(ExpectedConditions.not(ExpectedConditions.attributeToBeNotEmpty(video, "srcObject")));
        Assert.assertFalse("Videos were expected to lack srcObject property",
                user.getEventManager().hasMediaStream(video, ""));
    }

    for (WebElement el : publishButtons) {
        el.click();
    }

    user.getEventManager().waitUntilEventReaches("streamCreated", 8);
    user.getEventManager().waitUntilEventReaches("streamPlaying", 8);
    Assert.assertTrue("Videos were expected to have audio and video tracks", user.getEventManager()
            .assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));

    gracefullyLeaveParticipants(2);
}

From source file:org.alfresco.po.common.renderable.Renderable.java

License:Open Source License

/**
 * Wait for the annotated html elements on this renderable item
 *//* www. ja  v  a 2 s  .  c om*/
private void waitFor() {
    for (Map.Entry<WrapsElement, WaitFor> entry : getWaitForHTMLElements().entrySet()) {
        WrapsElement element = entry.getKey();
        switch (entry.getValue().status()) {
        case VISIBLE: {
            webDriverWait().until(ExpectedConditions.visibilityOf(element.getWrappedElement()));
            break;
        }
        case HIDDEN: {
            webDriverWait().until(
                    ExpectedConditions.not(ExpectedConditions.visibilityOf(element.getWrappedElement())));
            break;
        }
        case CLICKABLE: {
            webDriverWait().until(ExpectedConditions.elementToBeClickable(element.getWrappedElement()));
            break;
        }
        }
    }
}

From source file:org.cerberus.service.webdriver.impl.WebDriverService.java

License:Open Source License

@Override
public boolean isElementNotPresent(Session session, Identifier identifier) {
    By locator = this.getBy(identifier);
    MyLogger.log(WebDriverService.class.getName(), Level.DEBUG, "Waiting for Element to be not present : "
            + identifier.getIdentifier() + "=" + identifier.getLocator());
    try {/*  w ww .  j a  va2s . com*/
        WebDriverWait wait = new WebDriverWait(session.getDriver(),
                TimeUnit.MILLISECONDS.toSeconds(session.getCerberus_selenium_wait_element()));
        return wait.until(ExpectedConditions.not(ExpectedConditions.presenceOfElementLocated(locator)));
    } catch (TimeoutException exception) {
        MyLogger.log(WebDriverService.class.getName(), Level.FATAL,
                "Exception waiting for element to be not present :" + exception);
        return false;
    }
}

From source file:org.cerberus.service.webdriver.impl.WebDriverService.java

License:Open Source License

@Override
public boolean isElementNotClickable(Session session, Identifier identifier) {
    By locator = this.getBy(identifier);
    MyLogger.log(WebDriverService.class.getName(), Level.DEBUG, "Waiting for Element to be not clickable : "
            + identifier.getIdentifier() + "=" + identifier.getLocator());
    try {/*  w ww  .  ja v a2 s  . c o  m*/
        WebDriverWait wait = new WebDriverWait(session.getDriver(),
                TimeUnit.MILLISECONDS.toSeconds(session.getCerberus_selenium_wait_element()));
        return wait.until(ExpectedConditions.not(ExpectedConditions.elementToBeClickable(locator)));
    } catch (TimeoutException exception) {
        MyLogger.log(WebDriverService.class.getName(), Level.FATAL,
                "Exception waiting for element to be not clickable :" + exception);
        return false;
    }
}

From source file:org.eclipse.che.selenium.pageobject.FindText.java

License:Open Source License

/** wait the 'Search' button is disabled on the main form */
public void waitSearchBtnMainFormIsDisabled() {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC).until(
            ExpectedConditions.not(ExpectedConditions.elementToBeClickable(By.id(Locators.SEARCH_BUTTON))));
}

From source file:org.eclipse.che.selenium.pageobject.git.GitFetch.java

License:Open Source License

public void waitFetchBtnIsDisabled() {
    new WebDriverWait(seleniumWebDriver, 5)
            .until(ExpectedConditions.not(ExpectedConditions.elementToBeClickable(fetchBtn)));
}

From source file:org.eclipse.che.selenium.pageobject.git.GitMerge.java

License:Open Source License

public void waitMergeBtnIsDisabled() {
    new WebDriverWait(seleniumWebDriver, 7)
            .until(ExpectedConditions.not(ExpectedConditions.elementToBeClickable(mergeMergeBtn)));
}

From source file:org.eclipse.che.selenium.pageobject.git.GitPull.java

License:Open Source License

public void waitPullBtnIsDisabled() {
    new WebDriverWait(seleniumWebDriver, 5)
            .until(ExpectedConditions.not(ExpectedConditions.elementToBeClickable(pullBtn)));
}

From source file:org.eclipse.che.selenium.pageobject.git.GitPush.java

License:Open Source License

public void waitPushBtnIsDisabled() {
    new WebDriverWait(seleniumWebDriver, 7)
            .until(ExpectedConditions.not(ExpectedConditions.elementToBeClickable(pushBtn)));
}

From source file:org.eclipse.che.selenium.pageobject.PopupDialogsBrowser.java

License:Open Source License

/** Wait pop up browser window is closed */
public void waitAlertClose() {
    new WebDriverWait(seleniumWebDriver, 20).until(ExpectedConditions.not(ExpectedConditions.alertIsPresent()));
}