public List<WebElement> getElementsByTagName(String tagName) { assertElementNotStale(); List<?> allChildren = element.getByXPath(".//" + tagName); List<WebElement> elements = new ArrayList<WebElement>(); for (Object o : allChildren) { if (!(o instanceof HtmlElement)) continue; HtmlElement child = (HtmlElement) o; elements.add(getParent().newHtmlUnitWebElement(child)); } return elements; }
public List<WebElement> findElementsByXPath(String xpathExpr) { assertElementNotStale(); List<WebElement> webElements = new ArrayList<WebElement>(); List<?> htmlElements = element.getByXPath(xpathExpr); for (Object e : htmlElements) { webElements.add(getParent().newHtmlUnitWebElement((HtmlElement) e)); } return webElements; }
/** * Handle special case where table is empty. * {@inheritDoc} */ @Override public Object insertRow(final int index) { // check if a tbody should be created final List<?> rowContainers = getDomNodeOrDie().getByXPath("//tbody | //thead | //tfoot"); if (rowContainers.isEmpty() || index == 0) { final HtmlElement tBody = getDomNodeOrDie().appendChildIfNoneExists("tbody"); return ((RowContainer) getScriptableFor(tBody)).insertRow(0); } return super.insertRow(index); }
/** * Handle special case where table is empty. * {@inheritDoc} */ @Override public Object insertRow(final int index) { // check if a tbody should be created final List< ? > rowContainers = getDomNodeOrDie().getByXPath("//tbody | //thead | //tfoot"); if (rowContainers.isEmpty() || index == 0) { final HtmlElement tBody = getDomNodeOrDie().appendChildIfNoneExists("tbody"); return ((RowContainer) getScriptableFor(tBody)).insertRow(0); } return super.insertRow(index); }
/** * Handle special case where table is empty. * {@inheritDoc} */ @Override public Object insertRow(final int index) { // check if a tbody should be created final List< ? > rowContainers = getDomNodeOrDie().getByXPath("//tbody | //thead | //tfoot"); if (rowContainers.isEmpty() || index == 0) { final HtmlElement tBody = getDomNodeOrDie().appendChildIfNoneExists("tbody"); return ((RowContainer) getScriptableFor(tBody)).insertRow(0); } return super.insertRow(index); }
/** * Handle special case where table is empty. * {@inheritDoc} */ @Override public Object insertRow(final int index) { // check if a tbody should be created final List< ? > rowContainers = getDomNodeOrDie().getByXPath("//tbody | //thead | //tfoot"); if (rowContainers.isEmpty() || index == 0) { final HtmlElement tBody = getDomNodeOrDie().appendChildIfNoneExists("tbody"); return ((RowContainer) getScriptableFor(tBody)).insertRow(0); } return super.insertRow(index); }
/** * Handle special case where table is empty. * {@inheritDoc} */ @Override public Object insertRow(final int index) { // check if a tbody should be created final List<?> rowContainers = getDomNodeOrDie().getByXPath("//tbody | //thead | //tfoot"); if (rowContainers.isEmpty() || index == 0) { final HtmlElement tBody = getDomNodeOrDie().appendChildIfNoneExists("tbody"); return ((RowContainer) getScriptableFor(tBody)).insertRow(0); } return super.insertRow(index); }
HtmlAnchor sortByDateLink = ((List<HtmlAnchor>) filterDiv.getByXPath("//ul/li/a")).get(0);