Example usage for org.openqa.selenium By cssSelector

List of usage examples for org.openqa.selenium By cssSelector

Introduction

In this page you can find the example usage for org.openqa.selenium By cssSelector.

Prototype

public static By cssSelector(String cssSelector) 

Source Link

Document

Find elements via the driver's underlying W3C Selector engine.

Usage

From source file:com.cognifide.qa.bb.aem.ui.parsys.AemParsys.java

License:Apache License

/**
 * Remove all components in parsys.//from   w  w w.  j  a  v a2  s .c om
 *
 * @return This AemParsys.
 */
public AemParsys clear() {
    List<WebElement> list = currentScope.findElements(By.cssSelector(SELECTOR_FOR_COMPONENT_IN_PARSYS));
    list.forEach(this::removeComponentByContextMenu);
    return this;
}

From source file:com.cognifide.qa.bb.aem.ui.parsys.AemParsys.java

License:Apache License

/**
 * @return Number of components inserted into parsys.
 *//*  w w  w. j  a v  a  2s  . c  om*/
public int componentsCount() {
    return currentScope.findElements(By.cssSelector(SELECTOR_FOR_COMPONENT_IN_PARSYS)).size();
}

From source file:com.cognifide.qa.bb.aem.ui.parsys.AemParsys.java

License:Apache License

private By getComponentLocator(String componentCssClass) {
    return By.cssSelector(String.format(componentLocatorFormat, componentCssClass));
}

From source file:com.cognifide.qa.bb.aem.ui.sidekick.AemSidekick.java

License:Apache License

/**
 * This method expands/collapses specified component group
 *
 * @param groupName name of the group/* www .  java2 s .  c  o  m*/
 * @return AemSidekick sidekick
 */
public AemSidekick clickComponentGroupToggle(String groupName) {
    final Map<String, WebElement> groupByNames = getGroupsByNames();
    if (groupByNames.containsKey(groupName)) {
        groupByNames.get(groupName).findElement(By.cssSelector(SECTION_TOGGLE_CSS)).click();
    }
    return this;
}

From source file:com.cognifide.qa.bb.aem.ui.sidekick.AemSidekick.java

License:Apache License

/**
 * Provides a draggable object that represents a component present in the sidekick.
 *
 * @param component the component/*w w w .  j ava  2 s. co m*/
 * @return Draggable
 */
public Draggable getDraggable(Class<?> component) {
    this.clickTab(SidekickTab.COMPONENTS);
    String cssSelector = new AemComponentHandler(component).getSidekickCssSelector();
    if (StringUtils.isEmpty(cssSelector)) {
        throw new IllegalArgumentException("Class " + component.getSimpleName()
                + " does not have sidekickCssSelector defined within @AemComponent annotation");
    }
    WebElement webElement = driver.findElement(By.cssSelector(cssSelector));
    return dragAndDropFactory.createDraggable(webElement, framePath);
}

From source file:com.cognifide.qa.bb.aem.ui.sidekick.SidekickGridRow.java

License:Apache License

/**
 * Selects checbox in AemSidekick grid based
 *
 * @return instance of AemSidekick//from  www .j  a  v  a  2 s .com
 */
public SidekickGridRow selectGridCheckbox() {
    if (!isGridRowCheckboxSelected()) {
        bobcatWait.withTimeout(Timeouts.BIG).until(driver -> {
            gridRow.findElement(By.cssSelector(GRID_CHECKBOX_CSS)).click();
            return isGridRowCheckboxSelected();
        }, 5);
    }
    return this;
}

From source file:com.cognifide.qa.bb.aem.ui.sidekick.SidekickGridRow.java

License:Apache License

/**
 * Get cells from grid row
 *
 * @return List of row cells
 */
public List<WebElement> getCells() {
    return gridRow.findElements(By.cssSelector(GRID_CELLS_CSS));
}

From source file:com.cognifide.qa.bb.aem.ui.wcm.constants.SiteAdminButtons.java

License:Apache License

SiteAdminButtons(String locator) {
    this.locator = (By.ByCssSelector) By.cssSelector(locator);
}

From source file:com.cognifide.qa.bb.aem.ui.wcm.windows.CreateSiteWindow.java

License:Apache License

/**
 * Selects chapters on Chapters view/*from  w ww.  j a va2 s  .co  m*/
 *
 * @param chapters list of languages
 * @return this CreateSiteWindow
 */
public CreateSiteWindow selectChapters(List<String> chapters) {
    List<WebElement> items = currentWindow
            .findElements(By.cssSelector(".cq-msm_58chapterPages .x-form-check-wrap"));
    for (WebElement item : items) {
        WebElement label = item.findElement(By.tagName("label"));
        if (!chapters.contains(label.getText())) {
            item.findElement(By.tagName("input")).click();
        }
    }
    return this;
}

From source file:com.cognifide.qa.bb.aem.ui.window.ValidationWindow.java

License:Apache License

/**
 * Confirms the window by clicking OK button, waits until it's not visible.
 *///from w  w  w. ja va2 s  .com
public void confirm() {
    okButton.click();
    bobcatWait.withTimeout(Timeouts.SMALL).until(elementNotPresentOrVisible(By.cssSelector(CSS)));
}