Search in sources :

Example 91 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project cerberus-source by cerberustesting.

the class WebDriverService method isElementNotPresent.

@Override
public boolean isElementNotPresent(Session session, Identifier identifier) {
    By locator = this.getBy(identifier);
    LOG.debug("Waiting for Element to be not present : " + identifier.getIdentifier() + "=" + identifier.getLocator());
    try {
        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) {
        LOG.warn("Exception waiting for element to be not present :" + exception);
        return false;
    }
}
Also used : By(org.openqa.selenium.By) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) TimeoutException(org.openqa.selenium.TimeoutException)

Example 92 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project cerberus-source by cerberustesting.

the class WebDriverService method isElementNotVisible.

@Override
public boolean isElementNotVisible(Session session, Identifier identifier) {
    By locator = this.getBy(identifier);
    LOG.debug("Waiting for Element to be not visible : " + identifier.getIdentifier() + "=" + identifier.getLocator());
    try {
        WebDriverWait wait = new WebDriverWait(session.getDriver(), TimeUnit.MILLISECONDS.toSeconds(session.getCerberus_selenium_wait_element()));
        return wait.until(ExpectedConditions.invisibilityOfElementLocated(locator));
    } catch (TimeoutException exception) {
        LOG.warn("Exception waiting for element to be not visible :" + exception);
        return false;
    }
}
Also used : By(org.openqa.selenium.By) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) TimeoutException(org.openqa.selenium.TimeoutException)

Example 93 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project devonfw-testing by devonfw.

the class GmailSignInPage method clickNextButton.

/**
 * Performs left mouse button click on 'Next' button element.
 *
 * @return new GmailWelcomePage object.
 */
public GmailWelcomePage clickNextButton() {
    getDriver().elementButton(selectorNextButton).click();
    WebDriverWait wait = new WebDriverWait(getDriver(), 2);
    wait.until(ExpectedConditions.urlContains("pwd"));
    return new GmailWelcomePage();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 94 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project devonfw-testing by devonfw.

the class GmailWelcomePage method clickNextButton.

/**
 * Performs left mouse button click on 'Next' button element.
 *
 * @return new GmailInboxPage object.
 */
public GmailInboxPage clickNextButton() {
    getDriver().elementButton(selectorNextButton).click();
    WebDriverWait wait = new WebDriverWait(getDriver(), 10);
    wait.until(ExpectedConditions.urlContains("#inbox"));
    return new GmailInboxPage();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 95 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project devonfw-testing by devonfw.

the class DynamicLoadingPage method getExampleTwoDynamicText.

/**
 * Returns example text.
 * <p>
 * Waits until WebElement representing waiting bar disappear. Then waits until example text will show up.
 * And after that returns example text.
 * </p>
 *
 * @param waitTime
 *            The amount of time designated for waiting until waiting bar disappears and example text shows.
 * @return String representing example's text.
 */
public String getExampleTwoDynamicText(int waitTime) {
    WebDriverWait wait = new WebDriverWait(getDriver(), waitTime);
    wait.until(ExpectedConditions.invisibilityOf(getDriver().findElementDynamic(selectorLoadingBar)));
    wait.until(ExpectedConditions.visibilityOf(getDriver().findElementDynamic(selectorExampleText)));
    return getDriver().findElementDynamic(selectorExampleText).getText();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Aggregations

WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)527 WebElement (org.openqa.selenium.WebElement)166 WebDriver (org.openqa.selenium.WebDriver)131 Test (org.junit.Test)86 By (org.openqa.selenium.By)54 Actions (org.openqa.selenium.interactions.Actions)53 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)43 TimeoutException (org.openqa.selenium.TimeoutException)38 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)36 IOException (java.io.IOException)28 List (java.util.List)26 Wait (org.openqa.selenium.support.ui.Wait)25 BeforeClass (org.junit.BeforeClass)24 NgWebDriver (com.github.sergueik.jprotractor.NgWebDriver)21 ArrayList (java.util.ArrayList)21 WebDriverException (org.openqa.selenium.WebDriverException)21 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)21 Dimension (org.openqa.selenium.Dimension)20 File (java.io.File)16 NoSuchElementException (org.openqa.selenium.NoSuchElementException)16