Search in sources :

Example 1 with CachedHtmlElement

use of com.seleniumtests.uipage.htmlelements.CachedHtmlElement in project seleniumRobot by bhecquet.

the class AngularMaterialSelect method getOptions.

@Override
public List<WebElement> getOptions() {
    parentElement.findElement(locatorClickToOpen).click();
    if (locatorParentOfDropdown == null) {
        String classes = new HtmlElement("", new ByAll(By.className(CLASS_MAT_SELECT_PANEL), By.className(CLASS_MAT_SELECT_CONTENT)), frameElement).getAttribute("class");
        if (classes.contains(CLASS_MAT_SELECT_CONTENT)) {
            locatorParentOfDropdown = By.className(CLASS_MAT_SELECT_CONTENT);
        } else {
            locatorParentOfDropdown = By.className(CLASS_MAT_SELECT_PANEL);
        }
    }
    options = new HtmlElement("options", locatorParentOfDropdown, frameElement).findHtmlElements(locatorOption).stream().map(CachedHtmlElement::new).collect(Collectors.toList());
    return options;
}
Also used : ByAll(org.openqa.selenium.support.pagefactory.ByAll) CachedHtmlElement(com.seleniumtests.uipage.htmlelements.CachedHtmlElement) HtmlElement(com.seleniumtests.uipage.htmlelements.HtmlElement) CachedHtmlElement(com.seleniumtests.uipage.htmlelements.CachedHtmlElement)

Example 2 with CachedHtmlElement

use of com.seleniumtests.uipage.htmlelements.CachedHtmlElement in project seleniumRobot by bhecquet.

the class AngularSelect method getOptions.

/**
 * Method for getting list of options when this list is not available without clicking the list
 * It first click on element located by 'locatorClickToOpen' element
 * This should make the element located by 'locatorParentOfDropdown' available in DOM
 * => we look for all options located by 'locatorOption'
 * All these options are cached so that combobox can be closed. It will not be necessary to open it to know the value of an element.
 */
@Override
public List<WebElement> getOptions() {
    parentElement.findElement(locatorClickToOpen).click();
    HtmlElement dropdownElement = new HtmlElement("options", locatorParentOfDropdown, frameElement);
    if (debug) {
        logger.info("drop down HTML");
        logger.info(dropdownElement.getAttribute("outerHTML"));
    }
    options = dropdownElement.findHtmlElements(locatorOption).stream().map(CachedHtmlElement::new).collect(Collectors.toList());
    return options;
}
Also used : CachedHtmlElement(com.seleniumtests.uipage.htmlelements.CachedHtmlElement) HtmlElement(com.seleniumtests.uipage.htmlelements.HtmlElement) CachedHtmlElement(com.seleniumtests.uipage.htmlelements.CachedHtmlElement)

Aggregations

CachedHtmlElement (com.seleniumtests.uipage.htmlelements.CachedHtmlElement)2 HtmlElement (com.seleniumtests.uipage.htmlelements.HtmlElement)2 ByAll (org.openqa.selenium.support.pagefactory.ByAll)1