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:com.xwikisas.xcs.test.po.tour.XCSPageWithTour.java

License:Open Source License

@Override
public void close() {
    getDriver().findElement(By.xpath("//button[@data-role='end' and contains(@class, 'btn-default')]")).click();
    getDriver().waitUntilCondition(/*from  www  .ja va2s .c o m*/
            ExpectedConditions.not(ExpectedConditions.presenceOfAllElementsLocatedBy(By.className("tour"))));
}

From source file:de.knowwe.uitest.UITestUtils.java

License:Open Source License

public static void awaitStatusChange(WebDriver driver, String status) {
    new WebDriverWait(driver, 10).until(ExpectedConditions
            .not(ExpectedConditions.attributeToBe(By.cssSelector("#knowWEInfoStatus"), "value", status)));
}

From source file:functional.org.ojbc.web.portal.controllers.TestBase.java

License:RPL License

public static void waitForTextNotPresentFromInput(By by, String text, WebDriver driver) {
    WebDriverWait webDriverWait = new WebDriverWait(driver, WAIT_IN_SECONDS);
    try {//from ww  w  .  j  av a2 s. c o m
        webDriverWait.until(ExpectedConditions.not(ExpectedConditions.textToBePresentInElement(by, text)));
    } catch (Exception ex) {

    }
}

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();//  ww w.java 2 s  .  co m
    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  ww w .j a v  a 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();// w w w  .  j a  v a2 s . c o m
        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();//ww  w  . j  a  v a2s  . c om
        assertFalse(by.toString() + " did not uncheck!", isChecked(by));
    }
    return this;
}

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

License:Open Source License

public Locomotive selectOptionByText(By by, String text) {
    Select box = new Select(waitForElement(by));
    waitForCondition(ExpectedConditions.not(ExpectedConditions.invisibilityOfElementLocated(by)))
            .waitForCondition(ExpectedConditions.elementToBeClickable(by));
    box.selectByVisibleText(text);//from   w  w  w . j  a v a2 s. co  m
    return this;
}

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

License:Open Source License

public Locomotive selectOptionByValue(By by, String value) {
    Select box = new Select(waitForElement(by));
    waitForCondition(ExpectedConditions.not(ExpectedConditions.invisibilityOfElementLocated(by)))
            .waitForCondition(ExpectedConditions.elementToBeClickable(by));
    box.selectByValue(value);//from   w  w  w  . j a v  a2  s .com
    return this;
}

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

License:Apache License

@Test
@DisplayName("Subscribe Unsubscribe")
void subscribeUnsubscribeTest() throws Exception {

    setupBrowser("chrome");

    log.info("Subscribe Unsubscribe");

    user.getDriver().findElement(By.id("one2one-btn")).click();
    user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .publish-checkbox")).click();

    user.getDriver().findElements(By.className("join-btn")).forEach(el -> el.sendKeys(Keys.ENTER));

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

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

    // Global unsubscribe-subscribe
    WebElement subscriberVideo = user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 video"));
    WebElement subBtn = user.getDriver().findElement(By.cssSelector(("#openvidu-instance-0 .sub-btn")));
    subBtn.click();//from ww w  .j  a v  a2 s.c  o m

    user.getWaiter().until(
            ExpectedConditions.not(ExpectedConditions.attributeToBeNotEmpty(subscriberVideo, "srcObject")));
    Assert.assertFalse("Subscriber video should not have srcObject defined after unsubscribe",
            user.getEventManager().hasMediaStream(subscriberVideo, "#openvidu-instance-0"));

    subBtn.click();
    user.getEventManager().waitUntilEventReaches("streamPlaying", 3);

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

    // Video unsubscribe
    subscriberVideo = user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 video"));
    Iterable<WebElement> firstVideo = Arrays.asList(subscriberVideo);
    user.getDriver().findElement(By.cssSelector(("#openvidu-instance-0 .sub-video-btn"))).click();
    Thread.sleep(1000);
    Assert.assertTrue("Subscriber video was expected to only have audio track",
            user.getEventManager().assertMediaTracks(firstVideo, true, false));

    // Audio unsubscribe
    user.getDriver().findElement(By.cssSelector(("#openvidu-instance-0 .sub-audio-btn"))).click();
    Thread.sleep(1000);
    Assert.assertTrue("Subscriber video was expected to not have video or audio tracks",
            user.getEventManager().assertMediaTracks(firstVideo, false, false));

    // Video and audio subscribe
    user.getDriver().findElement(By.cssSelector(("#openvidu-instance-0 .sub-video-btn"))).click();
    Thread.sleep(1000);
    Assert.assertTrue("Subscriber video was expected to only have video track",
            user.getEventManager().assertMediaTracks(firstVideo, false, true));
    user.getDriver().findElement(By.cssSelector(("#openvidu-instance-0 .sub-audio-btn"))).click();
    Thread.sleep(1000);
    Assert.assertTrue("Subscriber video was expected to have audio and video tracks",
            user.getEventManager().assertMediaTracks(firstVideo, true, true));

    gracefullyLeaveParticipants(2);
}