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:org.wso2.es.ui.integration.test.store.ESStoreSearchGadgetListTestCase.java

License:Open Source License

@Test(groups = "wso2.es.store", description = "Search By Category Template", dependsOnMethods = "testESStoreSearchNewlyAddedAssetsName")
public void testStoreSearchByCategoryTemplate() throws Exception {
    driver.get(baseUrl + "/store/pages/top-assets");
    driver.findElement(By.cssSelector("i.icon-cog")).click();
    driver.findElement(By.cssSelector("i.icon-sort-down")).click();
    driver.findElement(By.id("search")).click();
    new Select(driver.findElement(By.id("overview_category"))).selectByVisibleText("Templates");
    driver.findElement(By.id("search-button2")).click();
    wait.until(ExpectedConditions
            .not(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector("h4"), assetName)));
    assertEquals(6, driver.findElements(By.cssSelector("div.span3.asset")).size(),
            "Number of Template gadgets are incorrect");

}

From source file:org.wso2.es.ui.integration.test.store.ESStoreSearchGadgetListTestCase.java

License:Open Source License

@Test(groups = "wso2.es.store", description = "Search By Category-Google and Provider-Admin", dependsOnMethods = "testESStoreSearchNewlyAddedAssetsName")
public void testESStoreSearchGadgetByProviderAndCategory() throws Exception {
    driver.get(baseUrl + "/store/pages/top-assets?null");
    driver.findElement(By.cssSelector("i.icon-cog")).click();
    driver.findElement(By.cssSelector("i.icon-sort-down")).click();
    driver.findElement(By.id("search")).click();
    driver.findElement(By.name("overview_provider")).clear();
    driver.findElement(By.name("overview_provider")).sendKeys(adminUserName);
    driver.findElement(By.id("search-button2")).click();
    wait.until(ExpectedConditions
            .not(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector("h4"), assetName)));
    assertEquals(2, driver.findElements(By.cssSelector("div.asset-details")).size(),
            "Seach result count does not match");

}

From source file:org.xwiki.contrib.tour.test.po.PageWithTour.java

License:Open Source License

public void previousStep() {
    // Get the current step id
    String stepId = getStepId();/*from   w  w  w.  j av  a 2  s  . c o  m*/
    // Click
    getDriver().findElement(By.xpath("//button[@data-role='prev']")).click();
    // Wait until current state disappears
    getUtil().waitUntilCondition(
            ExpectedConditions.not(ExpectedConditions.presenceOfAllElementsLocatedBy(By.id(stepId))));
    // Wait until new step appears
    getUtil().waitUntilCondition(ExpectedConditions.presenceOfElementLocated(By.className("tour")));
}

From source file:org.xwiki.contrib.tour.test.po.PageWithTour.java

License:Open Source License

public void nextStep() {
    // Get the current step id
    String stepId = getStepId();// w w w .ja  v a  2 s. c  o m
    // Click
    getDriver().findElement(By.xpath("//button[@data-role='next']")).click();
    // Wait until current state disappears
    getUtil().waitUntilCondition(
            ExpectedConditions.not(ExpectedConditions.presenceOfAllElementsLocatedBy(By.id(stepId))));
    // Wait until new step appear
    getUtil().waitUntilCondition(ExpectedConditions.presenceOfElementLocated(By.className("tour")));
}

From source file:org.xwiki.contrib.tour.test.po.PageWithTour.java

License:Open Source License

public void end() {
    getDriver().findElement(By.xpath("//div[contains(@class, 'popover-navigation')]//button[@data-role='end']"))
            .click();//from ww  w .  j a v  a2  s.  c  o m
    getUtil().waitUntilCondition(
            ExpectedConditions.not(ExpectedConditions.presenceOfAllElementsLocatedBy(By.className("tour"))));
}

From source file:org.xwiki.contrib.tour.test.po.PageWithTour.java

License:Open Source License

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

From source file:selenium_tumblr_test.BasePage.java

License:Open Source License

public void clickThenWaitForElementToDisappear(By elementBy, int seconds) {
    try {/*  www .  j  a  v  a  2s  . c  om*/
        // find element & click it
        WebElement element = driver.findElement(elementBy);
        element.click();

        // now wait until element is no longer present or timeout
        try {
            (new FluentWait(driver)).withTimeout(seconds, TimeUnit.SECONDS)
                    .pollingEvery(pollInterval, TimeUnit.SECONDS)
                    .until(ExpectedConditions.not(ExpectedConditions.presenceOfElementLocated(elementBy)));
        } catch (NoSuchElementException noSuchElementException) {

        } catch (TimeoutException timeoutException) {

        }

        // handle any alerts if they pop up
    } catch (org.openqa.selenium.UnhandledAlertException unhandledAlertException) {
        try {
            // try to switch to the alert dialog and accept it
            Alert alert = driver.switchTo().alert();
            alert.accept();
        } catch (org.openqa.selenium.NoAlertPresentException noAlertPresentException) {
            // alert may have gone away. if so, then ignore
        }
    }
}