/** * Returns the {@link HtmlAnchor} with the specified href. * * @param href the string to search by * @return the HtmlAnchor * @throws ElementNotFoundException if the anchor could not be found */ public HtmlAnchor getAnchorByHref(final String href) throws ElementNotFoundException { return getDocumentElement().getOneHtmlElementByAttribute("a", "href", href); }
/** * Gets the title element for this page. Returns null if one is not found. * * @return the title element for this page or null if this is not one */ private HtmlTitle getTitleElement() { return (HtmlTitle) getFirstChildElementRecursive(getDocumentElement(), HtmlTitle.class); }
/** * Returns a list of all the forms in this page. * @return all the forms in this page */ public List<HtmlForm> getForms() { return getDocumentElement().getElementsByTagNameImpl("form"); }
/** * Returns a list of all anchors contained in this page. * @return the list of {@link HtmlAnchor} in this page */ public List<HtmlAnchor> getAnchors() { return getDocumentElement().getElementsByTagNameImpl("a"); }
/** * Returns a list of all anchors contained in this page. * @return the list of {@link HtmlAnchor} in this page */ public List<HtmlAnchor> getAnchors() { return getDocumentElement().getHtmlElementsByTagName("a"); }
/** * Returns the {@link HtmlAnchor} with the specified name. * * @param name the name to search by * @return the {@link HtmlAnchor} with the specified name * @throws ElementNotFoundException if the anchor could not be found */ public HtmlAnchor getAnchorByName(final String name) throws ElementNotFoundException { return getDocumentElement().getOneHtmlElementByAttribute("a", "name", name); }
/** * Returns a list of all the forms in this page. * @return all the forms in this page */ public List<HtmlForm> getForms() { return getDocumentElement().getHtmlElementsByTagName("form"); }
/** * Gets the title element for this page. Returns null if one is not found. * * @return the title element for this page or null if this is not one */ private HtmlTitle getTitleElement() { return (HtmlTitle) getFirstChildElementRecursive(getDocumentElement(), HtmlTitle.class); }
/** * Returns a list of all anchors contained in this page. * @return the list of {@link HtmlAnchor} in this page */ public List<HtmlAnchor> getAnchors() { return getDocumentElement().getHtmlElementsByTagName("a"); }
/** * Returns the {@link HtmlAnchor} with the specified name. * * @param name the name to search by * @return the {@link HtmlAnchor} with the specified name * @throws ElementNotFoundException if the anchor could not be found */ public HtmlAnchor getAnchorByName(final String name) throws ElementNotFoundException { return getDocumentElement().getOneHtmlElementByAttribute("a", "name", name); }
/** * Returns a list of all the forms in this page. * @return all the forms in this page */ public List<HtmlForm> getForms() { return getDocumentElement().getHtmlElementsByTagName("form"); }
public HtmlElement getNextPage(HtmlPage page) { HtmlElement next = null; DomNodeList<HtmlElement> buttons = page.getDocumentElement().getElementsByTagName("button"); for (HtmlElement a : buttons) { // System.out.println(a); if (a.toString().toLowerCase().contains("pagenext")) { assert (next == null); next = a; } } return next; }
/** * Asserts that the XPath matches. */ public void assertXPath(HtmlPage page, String xpath) { assertNotNull("There should be an object that matches XPath:"+xpath, page.getDocumentElement().selectSingleNode(xpath)); }
/** * Gets the title element for this page. Returns null if one is not found. * * @return the title element for this page or null if this is not one */ private HtmlTitle getTitleElement() { final HtmlHead head = (HtmlHead) getFirstChildElement(getDocumentElement(), HtmlHead.class); if (head != null) { return (HtmlTitle) getFirstChildElement(head, HtmlTitle.class); } return null; }
/** * Gets the title element for this page. Returns null if one is not found. * * @return the title element for this page or null if this is not one */ private HtmlTitle getTitleElement() { final HtmlHead head = (HtmlHead) getFirstChildElement(getDocumentElement(), HtmlHead.class); if (head != null) { return (HtmlTitle) getFirstChildElement(head, HtmlTitle.class); } return null; }
/** * Gets the title element for this page. Returns null if one is not found. * * @return the title element for this page or null if this is not one */ private HtmlTitle getTitleElement() { final HtmlHead head = (HtmlHead) getFirstChildElement(getDocumentElement(), HtmlHead.class); if (head != null) { return (HtmlTitle) getFirstChildElement(head, HtmlTitle.class); } return null; }
/** {@inheritDoc} */ @Override protected void runJavaScript(final HtmlPage page) { final DomElement doc = page.getDocumentElement(); final Scriptable scriptable = page.getEnclosingWindow().getScriptableObject(); page.executeJavaScriptFunction(function_, scriptable, args_, doc); }
/** {@inheritDoc} */ @Override protected void runJavaScript(final HtmlPage page) { final HtmlElement doc = page.getDocumentElement(); final Scriptable scriptable = (Scriptable) page.getEnclosingWindow().getScriptObject(); page.executeJavaScriptFunctionIfPossible(function_, scriptable, new Object[0], doc); }
/** {@inheritDoc} */ @Override protected void runJavaScript(final HtmlPage page) { final HtmlElement doc = page.getDocumentElement(); final Scriptable scriptable = (Scriptable) page.getEnclosingWindow().getScriptObject(); page.executeJavaScriptFunctionIfPossible(function_, scriptable, new Object[0], doc); }
/** {@inheritDoc} */ @Override protected void runJavaScript(final HtmlPage page) { final HtmlElement doc = page.getDocumentElement(); final Scriptable scriptable = (Scriptable) page.getEnclosingWindow().getScriptObject(); page.executeJavaScriptFunctionIfPossible(function_, scriptable, new Object[0], doc); }