Search in sources :

Example 31 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project iTest by e-government-ua.

the class TemplatePage method mokAuthorization.

/**
     * ********************** Методы авторизации *************************
     */
public void mokAuthorization() {
    new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(buttonAuthMock));
    //выбираем Off AuthMock/BankID
    if (spanAuthMock.getText().equalsIgnoreCase("On AuthMock")) {
        cm.click(driver, buttonAuthMock);
    }
    cm.click(driver, buttonBankID);
    cm.clickXpath(driver, "//li[1]/a//span[contains(.,'ПриватБанк')]");
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 32 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project iTest by e-government-ua.

the class CustomMethods method SetRegionFieldInputTypeCheckbox.

public void SetRegionFieldInputTypeCheckbox(WebDriver driver, String serviceName, String cssSelector) {
    // //*[@id="bFavorite11"] //*[@id="field-bWrite"]/div
    WebElement checkbox = driver.findElement(By.cssSelector("#" + cssSelector));
    new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(checkbox));
    checkbox.click();
    checkbox.click();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 33 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project iTest by e-government-ua.

the class CustomMethods method setFieldCalendar.

public void setFieldCalendar(WebDriver driver, String serviceName, String cssSelector, String data) {
    WebElement webElement = driver.findElement(By.cssSelector("." + serviceName + "_--_" + cssSelector));
    new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(webElement));
    ((JavascriptExecutor) driver).executeScript("angular.element(document.getElementsByName('" + cssSelector + "')[0]).removeAttr('readonly');");
    webElement.click();
    webElement.clear();
    webElement.sendKeys(data);
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 34 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project iTest by e-government-ua.

the class CustomMethods method SetRegionFieldInputTypeString.

// Methods for filling the fields for central
public void SetRegionFieldInputTypeString(WebDriver driver, String serviceName, String cssSelector, String value) {
    WebElement webElement = driver.findElement(By.cssSelector("input[name='" + cssSelector + "']"));
    new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(webElement));
    //        webElement.click();
    webElement.clear();
    webElement.sendKeys(value);
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 35 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project opennms by OpenNMS.

the class BSMAdminIT method verifyElementNotPresent.

/**
 * Verifies that the provided element is not present.
 * @param by
 */
private static void verifyElementNotPresent(OpenNMSSeleniumTestCase testCase, final By by) {
    new WebDriverWait(testCase.getDriver(), 5).until(ExpectedConditions.not(new ExpectedCondition<Boolean>() {

        @Nullable
        @Override
        public Boolean apply(@Nullable WebDriver input) {
            try {
                // the default implicit wait timeout is too long, make it shorter
                input.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
                WebElement elementFound = input.findElement(by);
                return elementFound != null;
            } catch (NoSuchElementException ex) {
                return false;
            } finally {
                // set the implicit wait timeout back to the value it has been before
                input.manage().timeouts().implicitlyWait(LOAD_TIMEOUT, TimeUnit.MILLISECONDS);
            }
        }
    }));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) ExpectedCondition(org.openqa.selenium.support.ui.ExpectedCondition) WebElement(org.openqa.selenium.WebElement) Nullable(javax.annotation.Nullable) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Aggregations

WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)556 WebElement (org.openqa.selenium.WebElement)173 WebDriver (org.openqa.selenium.WebDriver)139 Test (org.junit.Test)88 By (org.openqa.selenium.By)58 Actions (org.openqa.selenium.interactions.Actions)54 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)47 TimeoutException (org.openqa.selenium.TimeoutException)41 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)38 IOException (java.io.IOException)30 List (java.util.List)27 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