List of usage examples for org.openqa.selenium By cssSelector
public static By cssSelector(String cssSelector)
From source file:com.cognifide.qa.bb.aem.ui.AemContentTree.java
License:Apache License
private WebElement getRootNode() { return currentScope.findElement(By.cssSelector(".x-tree-node")); }
From source file:com.cognifide.qa.bb.aem.ui.AemContentTree.java
License:Apache License
private boolean isContentTreeReady() { return webElementUtils.hasAttributeWithValue( getRootNodeContent().findElement(By.cssSelector(".x-tree-ec-icon")), HtmlTags.Attributes.CLASS, "x-tree-elbow-end-minus"); }
From source file:com.cognifide.qa.bb.aem.ui.AemContentTree.java
License:Apache License
private void clickNodeLabelAndWaitForClass(final WebElement node, final String expectedCssClass) { WebElement clickableArea = getNodeContent(node, By.cssSelector("div > a > span")); BobcatWebDriverWait wait = bobcatWait.withTimeout(Timeouts.SMALL); wait.until(ExpectedConditions.elementToBeClickable(clickableArea)); wait.until(driver -> {/*from w w w . j a v a 2 s .com*/ clickableArea.click(); return getNodeContent(node, By.cssSelector("div")).getAttribute(HtmlTags.Attributes.CLASS) .contains(expectedCssClass); }); }
From source file:com.cognifide.qa.bb.aem.ui.AemDialog.java
License:Apache License
private List<WebElement> getAllTabs() { bobcatWait.withTimeout(Timeouts.BIG) .until(ExpectedConditions.visibilityOfElementLocated(DIALOG_XPATH_COMPILED)); WebElement dialog = webDriver.findElement(DIALOG_XPATH_COMPILED); return dialog.findElements( By.cssSelector("div.x-tab-panel-header span.x-tab-strip-inner span.x-tab-strip-text")); }
From source file:com.cognifide.qa.bb.aem.ui.AemDialog.java
License:Apache License
private void waitForComponentOnParsys() { bobcatWait.withTimeout(Timeouts.BIG) .until(CommonExpectedConditions.listSizeIsConstant(currentScope, By.cssSelector(ID_CQ_GEN))); }
From source file:com.cognifide.qa.bb.aem.ui.AemDialogFieldResolver.java
License:Apache License
/** * Searches for the field of a given type, identified by the css class. * * @param css Css by which to locate the dialog field. * @param dialogFieldType Class that represents dialog field. * @param <T> dialog field class// w w w . j a va2s . com * @return A dialogFieldType's instance that represents dialog field. */ public <T> T getFieldByCss(String css, Class<T> dialogFieldType) { By selector = By.cssSelector(css); return getFieldBySelector(selector, dialogFieldType); }
From source file:com.cognifide.qa.bb.aem.ui.parsys.AemInsertWindow.java
License:Apache License
private WebElement chooseTab(String componentGroup) { try {// w w w .j a va 2s . c o m WebElement tab = currentScope.findElement(By.xpath( String.format(".//*[contains(@class,'x-panel-header')][.//span[normalize-space(text())=%s]]", XpathUtils.quote(componentGroup)))); if (TAB_FOLDED .equals(tab.findElement(By.cssSelector(".x-tool-toggle")).getCssValue("background-position"))) { tab.click(); } return tab; } catch (NoSuchElementException e) { throw new NoSuchElementException("No such tab: " + componentGroup, e); } }
From source file:com.cognifide.qa.bb.aem.ui.parsys.AemParsys.java
License:Apache License
/** * Opens context menu for n-th component, no matter what type it is. Indexing starts at 0. * * @param n option index/*from w w w .jav a 2 s .c o m*/ * @return opened contextMenu */ public AemContextMenu openContextMenu(int n) { contextMenu.open(currentScope.findElements(By.cssSelector(SELECTOR_FOR_COMPONENT_IN_PARSYS)).get(n)); return contextMenu; }
From source file:com.cognifide.qa.bb.aem.ui.parsys.AemParsys.java
License:Apache License
/** * Get the n-th component. Indexing starts at 0. * * @param componentClass component class name * @param <T> component class * @param globalIndex component global index * @return object of a componentClass injected with a proper scope */// w w w. j a va 2 s. c o m public <T> T getComponent(Class<T> componentClass, int globalIndex) { return pageObjectInjector.inject(componentClass, currentScope.findElements(By.cssSelector(SELECTOR_FOR_COMPONENT_IN_PARSYS)).get(globalIndex), currentFrame); }
From source file:com.cognifide.qa.bb.aem.ui.parsys.AemParsys.java
License:Apache License
/** * Remove the n-th(index) component, not matter what type it is. Indexing starts at 0. * * @param index component index/* w w w .ja va 2 s. c o m*/ * @return This AemParsys. */ public AemParsys removeComponent(int index) { try { WebElement webElement = currentScope.findElements(By.cssSelector(SELECTOR_FOR_COMPONENT_IN_PARSYS)) .get(index); removeComponentByContextMenu(webElement); waitForComponentToBeRemoved(webElement); } catch (ArrayIndexOutOfBoundsException e) { throw new NoSuchComponentException(e); } return this; }