@Override public List<WebElement> findElementsBy(final SearchContext context) { List<WebElement> matchingElems = null; final List<WebElement> tagElements = context.findElements(By.tagName(this.tagName)); for (final WebElement e : tagElements) { // does this WebElement have the attributes that we need! if (elementHasExpectedAttributes(e, this.requiredAttributes)) { if (matchingElems == null) { matchingElems = new ArrayList<WebElement>(); } matchingElems.add(e); } } if (matchingElems != null && matchingElems.size() < this.minimumExpected) { logger.info( "expecting at least " + this.minimumExpected + " matching elems, found only " + matchingElems.size() + " this time around"); // we haven't found enough, clear out matchingElems = null; } return matchingElems; }
public static boolean isVisible(SearchContext searchContext, By by) { try { boolean result = false; result = searchContext.findElement(by).isDisplayed(); return result; } catch (NoSuchElementException ex) { return false; } }
public static List<WebElement> findVisibleElements(By searchElements, SearchContext context) { List<WebElement> visibleElements = new java.util.ArrayList<WebElement>(); for (WebElement element : context.findElements(searchElements)) { if (element.isDisplayed()) { visibleElements.add(element); } } return visibleElements; }
/* * (non-Javadoc) * * @see * org.openqa.selenium.By#findElements(org.openqa.selenium.SearchContext * ) */ @Override public List<WebElement> findElementsBy(final SearchContext context) { List<WebElement> matchingElems = null; final List<WebElement> elems = context.findElements(By.id(this.id)); if (elems != null) { for (final WebElement e : elems) { if (e.getText() != null && e.getText().contains(this.text)) { if (matchingElems == null) { matchingElems = new ArrayList<WebElement>(); } matchingElems.add(e); } } } return matchingElems; }
/* * (non-Javadoc) * * @see * org.openqa.selenium.By#findElements(org.openqa.selenium.SearchContext * ) */ @Override public List<WebElement> findElementsBy(final SearchContext context) { List<WebElement> matchingElems = null; final List<WebElement> elems = context.findElements(By.tagName(this.tag)); if (elems != null) { for (final WebElement e : elems) { if (this.stringMatcher.matches(e.getText())) { if (matchingElems == null) { matchingElems = new ArrayList<WebElement>(); } matchingElems.add(e); } } } return matchingElems; }
/* * (non-Javadoc) * * @see * org.openqa.selenium.By#findElements(org.openqa.selenium.SearchContext * ) */ @Override public List<WebElement> findElementsBy(final SearchContext context) { List<WebElement> matchingElems = null; final List<WebElement> elems = context.findElements(By.id(this.id)); if (elems != null) { for (final WebElement e : elems) { if ((this.caseSensitive && this.text.equals(e.getText())) || (!this.caseSensitive && this.text.equalsIgnoreCase(e.getText()))) { if (matchingElems == null) { matchingElems = new ArrayList<WebElement>(); } matchingElems.add(e); } } } return matchingElems; }
protected ElementBase(SearchContext host, By locator) { this.host = host; this.locator = locator; wrappedElement = host.findElement(locator); }
@Override public Table apply(SearchContext context) { return new SimpleTable(context.findElement(by)); }
protected String getTime(SearchContext searchContext) { String time = searchContext.findElement(REQUEST_TIME).getText(); return time; }
private WebElement findWebElementByIdentification() { SearchContext searchContext = model.getSearchContext(); return searchContext.findElement(model.getSeleniumBy()); }
public WebElement findElement(By by) { findPlugins().beforeFindElement(browser, by); WebElement result = UiObject.wrap(searchContext.findElement(by), by); findPlugins().afterFindElement(browser, by, result); return result; }
public List<WebElement> findElements(By by) { findPlugins().beforeFindElement(browser, by); List<WebElement> result = UiObject.wrapAll(searchContext.findElements(by), by); findPlugins().afterFindElements(browser, by, result); return result; }
public List<WebElement> find(By by, DriverScope scope) { SearchContext context = seleniumScope(scope); return context.findElements(by); }
@Override public WebElement findElement(By by) { return element.findElement(by); }
@Override public List<WebElement> findElements(By by) { return element.findElements(by); }