Search in sources :

Example 36 with WebDriverWait

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

the class CustomMethods method setRegionTableCellsInputTypeString.

// Methods for filling the fields of table for central //._test_autotest_dashboard_--_sTable3_--_COL_sTables3Field1_--_ROW_0 input
public void setRegionTableCellsInputTypeString(WebDriver driver, String serviceName, String tableName, String cellName, String NameRow, String text) {
    WebElement td = driver.findElement(By.cssSelector("." + serviceName + "_--_" + tableName + "_--_COL_" + cellName + "_--_ROW_" + NameRow + " input"));
    new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(td));
    td.click();
    td.clear();
    td.sendKeys(text);
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 37 with WebDriverWait

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

the class CustomMethods method setFieldTypeSelect.

public void setFieldTypeSelect(WebDriver driver, String serviceName, String cssSelector, String row) {
    WebElement webElement = driver.findElement(By.cssSelector("#field-" + cssSelector));
    new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(webElement));
    webElement.click();
    //#ui-select-choices-row-1-1 > a #ui-select-choices-row-7-1 > a
    driver.findElement(By.cssSelector("#ui-select-choices-row" + row + " > a")).click();
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 38 with WebDriverWait

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

the class CustomMethods method setRegionTableCellsInputTypeEnum.

public void setRegionTableCellsInputTypeEnum(WebDriver driver, String serviceName, String tableName, String cellName, String NameRow, String text) {
    //ng-scope 
    WebElement td = driver.findElement(By.cssSelector(".ng-scope." + serviceName + "_--_" + tableName + "_--_COL_" + cellName + "_--_ROW_" + NameRow + " select[name='" + cellName + NameRow + "']"));
    new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(td));
    td.click();
    Select select = new Select(td);
    select.selectByVisibleText(text);
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Select(org.openqa.selenium.support.ui.Select)

Example 39 with WebDriverWait

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

the class CustomMethods method setFieldValue.

public void setFieldValue(WebDriver driver, String serviceName, String cssSelector, String value) {
    WebElement webElement = driver.findElement(By.cssSelector("." + serviceName + "_--_" + 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 40 with WebDriverWait

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

the class CustomMethods method setFieldSelectSlotTime.

// TODO Как будет нормальный локатор для выбора времени  Пример: ._test_all_case_--_visitTime переделать метод и перенести в кастом
public void setFieldSelectSlotTime(WebDriver driver, String serviceName, String cssSelector) {
    Boolean status;
    try {
        //By.xpath("//select[@ng-model='selected.slot']")
        WebElement webElement = driver.findElement(By.xpath("//select[@ng-model='selected.slot']"));
        new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(webElement));
        Select select = new Select(webElement);
        select.selectByValue("0");
        status = true;
    } catch (org.openqa.selenium.NoSuchElementException e) {
        status = false;
    }
    Assert.assertTrue(status, "NO AVAILABLE SLOTS TIME!, NO AVAILABLE SLOTS TIME!, NO AVAILABLE SLOTS TIME!");
}
Also used : org.openqa.selenium(org.openqa.selenium) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Select(org.openqa.selenium.support.ui.Select)

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