List of usage examples for org.openqa.selenium By cssSelector
public static By cssSelector(String cssSelector)
From source file:com.cognifide.qa.bb.aem.core.siteadmin.internal.TemplateListImpl.java
License:Apache License
@Override public void selectTemplate(String templateName) { WebElement template = templates.stream() .filter(t -> StringUtils.equals( t.findElement(By.cssSelector("coral-card-content coral-card-title")).getText(), templateName))//from w w w. j a v a 2 s . c o m .findFirst().orElseThrow(() -> new IllegalArgumentException("Template not found: " + templateName)); template.click(); }
From source file:com.cognifide.qa.bb.aem.dialog.classic.field.AemDropdown.java
License:Apache License
/** * Clicks the item in the dropdown list. Item is identified by the provided index. First item has * index 0./*from www. ja v a 2 s .c o m*/ * * @param index starts from 0 * @return this Aem dropdown object */ public AemDropdown selectByIndex(int index) { expandDropdown(); List<WebElement> items = bobcatWait.withTimeout(Timeouts.MEDIUM) .until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.cssSelector(ITEMS_LOCATOR))); items.get(index).click(); return this; }
From source file:com.cognifide.qa.bb.aem.dialog.classic.field.AemDropdown.java
License:Apache License
private void expandDropdown() { bobcatWait.withTimeout(Timeouts.BIG).until(driver -> { thisElement.click();//from ww w . ja va 2s . co m return !webDriver.findElements(By.cssSelector(ITEMS_LOCATOR)).isEmpty(); }, 5); }
From source file:com.cognifide.qa.bb.aem.dialog.classic.field.AemRichText.java
License:Apache License
/** * Clicks the button indicated by the parameter. * * @param button button/* w w w. j a v a 2 s . com*/ * @return This instance. */ @Frame("$cq") public AemRichText click(final RtButton button) { if (!buttonSelected(button)) { bobcatWait.withTimeout(Timeouts.BIG).until(driver -> { String valueBefore = getTextAreaInnerHtml(); enableRichTextIfDisabled(); webDriver.findElement(By.cssSelector(RT_BUTTON_CSS + button.getCss())).click(); return !valueBefore.equals(getTextAreaInnerHtml()); }, 2); } return this; }
From source file:com.cognifide.qa.bb.aem.dialog.classic.field.AemRichText.java
License:Apache License
private boolean buttonSelected(RtButton button) { return webDriver.findElement(By.cssSelector(SELECTED_BUTTON)).getAttribute(CLASS_ATTRIBUTE) .contains(button.getCss()); }
From source file:com.cognifide.qa.bb.aem.dialog.classic.field.tags.AemTags.java
License:Apache License
private int getTagCount() { return webDriver.findElements(By.cssSelector(TAGNAME)).size(); }
From source file:com.cognifide.qa.bb.aem.expectedconditions.ContentFinderActions.java
License:Apache License
/** * Collapses content finder and checks if collapse button hides. * * @return condition for content finder to be collapsed *//* w ww . j av a2 s. c om*/ public static ExpectedCondition<Boolean> collapse() { return driver -> { WebElement collapseButton = driver.findElement(By.cssSelector(COLLAPSE_BUTTON_CSS)); collapseButton.click(); return !collapseButton.isDisplayed(); }; }
From source file:com.cognifide.qa.bb.aem.expectedconditions.ContentFinderActions.java
License:Apache License
/** * Expands content finder and checks if expand button hides. * * @return condition for content finder to be expanded *///from www . j ava2 s. c o m public static ExpectedCondition<Boolean> expand() { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { WebElement expandButton = driver.findElement(By.cssSelector(EXPAND_BUTTON_CSS)); expandButton.click(); return !expandButton.isDisplayed(); } @Override public String toString() { return String.format(VIEW_IS_NOT_READY); } }; }
From source file:com.cognifide.qa.bb.aem.expectedconditions.SidekickActions.java
License:Apache License
/** * Expands section of sidekick and checks if its expanded now. * * @param section section to expand//w w w .ja v a 2 s. c om * @return condition for expanded section */ public static ExpectedCondition<Boolean> expandSection(final WebElement section) { return driver -> { if (isSectionExpanded(section)) { return Boolean.TRUE; } section.findElement(By.cssSelector(SECTION_TOGGLE_CSS)).click(); return isSectionExpanded(section); }; }
From source file:com.cognifide.qa.bb.aem.expectedconditions.SidekickActions.java
License:Apache License
/** * Expands fieldset of sidekick and checks if its expanded. * * @param fieldset fieldset to expand//from w w w . j av a2s. com * @return condition for expanded fieldset */ public static ExpectedCondition<Boolean> expandFieldset(final WebElement fieldset) { return driver -> { if (isFieldsetExpanded(fieldset)) { return Boolean.TRUE; } fieldset.findElement(By.cssSelector(SECTION_TOGGLE_CSS)).click(); return isFieldsetExpanded(fieldset); }; }