Search in sources :

Example 1 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project cucumber-jvm by cucumber.

the class NavigationStepdefs method i_am_on_the_front_page.

@Given("^I am on the front page$")
public void i_am_on_the_front_page() throws InterruptedException {
    webDriver.get("http://localhost:" + ServerHooks.PORT);
    // The input fields won't be enabled until the WebSocket has established
    // a connection. Wait for this to happen.
    WebDriverWait wait = new WebDriverWait(webDriver, 1);
    wait.until(ExpectedConditions.elementToBeClickable(By.id("celcius")));
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Given(cucumber.api.java.en.Given)

Example 2 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project android by owncloud.

the class Actions method login.

public static FileListView login(String url, String user, String password, Boolean isTrusted, AndroidDriver driver) throws InterruptedException {
    LoginForm loginForm = new LoginForm(driver);
    CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url);
    if (!isTrusted) {
        WebDriverWait wait = new WebDriverWait(driver, 30);
        //and it doesn't appear again
        try {
            wait.until(ExpectedConditions.visibilityOf(certificatePopUp.getOkButtonElement()));
            //we need to repaint the screen 
            //because of some element are misplaced
            driver.rotate(ScreenOrientation.LANDSCAPE);
            driver.rotate(ScreenOrientation.PORTRAIT);
            certificatePopUp.clickOnOkButton();
        } catch (NoSuchElementException e) {
        }
    }
    loginForm.typeUserName(user);
    loginForm.typePassword(password);
    //TODO. Assert related to check the connection?
    return loginForm.clickOnConnectButton();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) CertificatePopUp(com.owncloud.android.test.ui.models.CertificatePopUp) LoginForm(com.owncloud.android.test.ui.models.LoginForm) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 3 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project selenium-tests by Wikia.

the class FacebookSignupModalComponentObject method acceptWikiaAppPolicy.

public void acceptWikiaAppPolicy() {
    new WebDriverWait(driver, 10).until(new ExpectedCondition<Boolean>() {

        @Nullable
        @Override
        public Boolean apply(WebDriver input) {
            return input.getWindowHandles().size() > 1;
        }
    });
    Object[] handles = driver.getWindowHandles().toArray();
    driver.switchTo().window(handles[1].toString());
    wait.forElementVisible(By.cssSelector("button[name='__CONFIRM__']"));
    appTermsConfirmButton.click();
    PageObjectLogging.log("acceptWikiaAppPolicy", "confirmed wikia apps privacy policy", true);
    driver.switchTo().window(handles[0].toString());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WikiBasePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject) Nullable(javax.annotation.Nullable)

Example 4 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project selenium-tests by Wikia.

the class TopNoteModalDialog method clickApprove.

public void clickApprove() {
    super.clickConfirm();
    new WebDriverWait(driver, DiscussionsConstants.TIMEOUT).until((Predicate<WebDriver>) input -> !post.getAttribute("class").contains("is-reported"));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Predicate(com.google.common.base.Predicate) WebDriver(org.openqa.selenium.WebDriver) WebElement(org.openqa.selenium.WebElement) FindBy(org.openqa.selenium.support.FindBy) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 5 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project selenium-tests by Wikia.

the class DeleteDialog method confirmAndWait.

public void confirmAndWait() {
    super.clickConfirm();
    new WebDriverWait(driver, DiscussionsConstants.TIMEOUT).until((Predicate<WebDriver>) input -> postList.stream().allMatch(p -> p.getAttribute("class").contains("is-deleted")));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) List(java.util.List) Predicate(com.google.common.base.Predicate) WebDriver(org.openqa.selenium.WebDriver) WebElement(org.openqa.selenium.WebElement) FindBy(org.openqa.selenium.support.FindBy) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Aggregations

WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)544 WebElement (org.openqa.selenium.WebElement)170 WebDriver (org.openqa.selenium.WebDriver)134 Test (org.junit.Test)87 By (org.openqa.selenium.By)58 Actions (org.openqa.selenium.interactions.Actions)54 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)47 TimeoutException (org.openqa.selenium.TimeoutException)38 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)36 IOException (java.io.IOException)30 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)18 NoSuchElementException (org.openqa.selenium.NoSuchElementException)16