Search in sources :

Example 6 with CoralSelect

use of com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelect in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ButtonEditDialog method selectButtonType.

public void selectButtonType(String type) {
    $("[name='./type'] > button").click();
    CoralSelectList coralSelectList = new CoralSelectList($("[name='./type']"));
    if (!coralSelectList.isVisible()) {
        CoralSelect selectList = new CoralSelect("name='./type'");
        coralSelectList = selectList.openSelectList();
    }
    final WebDriver webDriver = WebDriverRunner.getWebDriver();
    WebElement element = webDriver.findElement(By.cssSelector("coral-selectlist-item[value='" + type + "']"));
    ((JavascriptExecutor) webDriver).executeScript("arguments[0].scrollIntoView(true);", element);
    coralSelectList.selectByValue(type);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) WebElement(org.openqa.selenium.WebElement) CoralSelectList(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList) CoralSelect(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelect)

Example 7 with CoralSelect

use of com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelect in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class FormOptionsEditDialog method setOptionType.

/**
 * Set the option type
 */
public void setOptionType(String optionType) {
    // Open selectlist
    $("[name='./type'] > button").click();
    CoralSelectList coralSelectList = new CoralSelectList($("[name='./type']"));
    if (!coralSelectList.isVisible()) {
        CoralSelect selectList = new CoralSelect("name='./type'");
        coralSelectList = selectList.openSelectList();
    }
    final WebDriver webDriver = WebDriverRunner.getWebDriver();
    WebElement element = webDriver.findElement(By.cssSelector("coral-selectlist-item[value='" + optionType + "']"));
    ((JavascriptExecutor) webDriver).executeScript("arguments[0].scrollIntoView(true);", element);
    coralSelectList.selectByValue(optionType);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) WebElement(org.openqa.selenium.WebElement) CoralSelectList(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList) CoralSelect(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelect)

Aggregations

CoralSelect (com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelect)7 CoralSelectList (com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList)7 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)5 WebDriver (org.openqa.selenium.WebDriver)5 WebElement (org.openqa.selenium.WebElement)5