List of usage examples for org.openqa.selenium By cssSelector
public static By cssSelector(String cssSelector)
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.pages.AuthorPage.java
License:Apache License
/** * Looks for css class of given component class and return its content. * * @param component component class./*from w w w.j av a 2 s . co m*/ * @return content of component. */ public <T> T getContent(Class<T> component) { Objects.requireNonNull(component, "clazz property was not specified in YAML config"); globalBar.switchToPreviewMode(); frameSwitcher.switchTo(CONTENT_FRAME); WebElement scope = null; try { String selector = (String) component.getField("CSS").get(null); scope = driver.findElement(By.cssSelector(selector)); } catch (IllegalAccessException e) { LOG.error("CSS was not accessible, injecting with default scope", e); } catch (NoSuchFieldException e) { LOG.error("CSS field was not present in the page object, injecting with default scope", e); } frameSwitcher.switchBack(); return scope == null ? pageObjectInjector.inject(component, CONTENT_FRAME) : pageObjectInjector.inject(component, scope, CONTENT_FRAME); }
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.pages.PublishPage.java
License:Apache License
public <T> T fromPage(Class<T> component) { WebElement scope = null;/*from www. j a v a 2 s.co m*/ try { String selector = (String) component.getField("CSS").get(null); scope = webDriver.findElement(By.cssSelector(selector)); } catch (IllegalAccessException e) { LOG.info("CSS not accessible, page object injected with default scope: {}", component.getName()); } catch (NoSuchFieldException e) { LOG.info("CSS field not present in the page object, page object injected with default scope: {}", component.getName()); } return scope == null ? pageObjectInjector.inject(component) : pageObjectInjector.inject(component, scope); }
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.pages.PublishPage.java
License:Apache License
private <T> T getFromScope(Class<T> component, By parentSelector) { WebElement scope;/* w w w .j av a 2 s. c om*/ try { String selector = (String) component.getField("CSS").get(null); scope = webDriver.findElement(parentSelector).findElement(By.cssSelector(selector)); } catch (IllegalAccessException e) { LOG.info("CSS was not accessible, injecting with default scope", e); scope = webDriver.findElement(parentSelector); } catch (NoSuchFieldException e) { LOG.info("CSS field was not present in the page object, injecting with default scope", e); scope = webDriver.findElement(parentSelector); } return scope == null ? pageObjectInjector.inject(component) : pageObjectInjector.inject(component, scope); }
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.touchui.ConfigDialog.java
License:Apache License
/** * Method used to verify if this element is visible. */ public void verifyIsDisplayed() { conditions.verifyPostAjax(visibilityOfElementLocated(By.cssSelector(CSS))); }
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.touchui.ConfigDialog.java
License:Apache License
/** * Method can be used to verify if this element is hidden. */ public void verifyIsHidden() { conditions.verifyPostAjax(invisibilityOfElementLocated(By.cssSelector(CSS))); }
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.touchui.DeleteDialog.java
License:Apache License
/** * Method verifies if the dialog is visible, then click delete button and verifies if dialog is not visible * anymore./*from w w w . j ava 2s . c o m*/ */ public void confirmDelete() { By dialogLocator = By.cssSelector(CSS); conditions.verifyPostAjax(visibilityOfElementLocated(dialogLocator)); deleteButton.click(); conditions.verifyPostAjax(invisibilityOfElementLocated(dialogLocator)); }
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.touchui.Parsys.java
License:Apache License
/** * it may happen that the window pops up just a moment before {@code dropArea.click(} happens, * which results in WebdriverException: 'Other element would receive the click' - thus it is * catched and validated/*from ww w .j a v a2 s. c o m*/ */ private void tryToOpenInsertWindow() { conditions.verify(ignored -> { try { boolean isInsertButtonPresent = driver.findElements(By.cssSelector(INSERT_BUTTON_SELECTOR)) .size() > 0; if (!isInsertButtonPresent) { // AEM 6.1 actions.doubleClick(dropArea).perform(); } else { // AEM 6.2 insertButton.click(); } } catch (WebDriverException e) { return e.getMessage().contains("Other element would receive the click"); } return insertComponentWindow.isDisplayedExpectingComponents(); }, Timeouts.MEDIUM); }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem61.MovePageWizard.java
License:Apache License
private List<WebElement> getPagesList() { return currentScope.findElements(By.cssSelector(PAGES_SELECTOR)); }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem61.MovePageWizard.java
License:Apache License
private void browseToContentRoot() { List<WebElement> crumbs = browsePathBreadcrumb.findElements(By.cssSelector(BREADCRUMBS_SELECTOR)); crumbs.get(0).click(); }
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem61.SiteadminPage.java
License:Apache License
private ChildPageWindow getChildPageWindow() { WebElement childPagesElement = driver.findElement(By.cssSelector(CHILD_PAGE_WINDOW_SELECTOR)); return pageObjectInjector.inject(ChildPageWindow.class, childPagesElement); }