Package org.htmlunit.html

# Class HtmlPage

java.lang.Object
org.htmlunit.html.DomNode
org.htmlunit.SgmlPage
org.htmlunit.html.HtmlPage

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Page`, `Document`, `Node`

Direct Known Subclasses:
  `XHtmlPage`

public class HtmlPage extends SgmlPage
A representation of an HTML page returned from a server.

This class provides different methods to access the page's content like `getForms()`, `getAnchors()`, `getElementById(String)`, ... as well as the very powerful inherited methods `DomNode.getByXPath(String)` and `DomNode.getFirstByXPath(String)` for fine grained user specific access to child nodes.

Child elements allowing user interaction provide methods for this purpose like `DomElement.click()`, `HtmlElement.type(String)`, `HtmlOption.setSelected(boolean)`, ...

HtmlPage instances should not be instantiated directly. They will be returned by `WebClient.getPage(String)` when the content type of the server's response is `text/html` (or one of its variations).
Example:
`final HtmlPage page = webClient.`getPage`("http://mywebsite/some/page.html");`

See Also:
  - Serialized Form

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.htmlunit.html.DomNode

  `DomNode.ChildIterator, DomNode.DescendantDomElementsIterator, DomNode.DescendantDomNodesIterator, DomNode.DescendantElementsIterator<T extends DomNode>, DomNode.DescendantHtmlElementsIterator`

- ## Field Summary

  ### Fields inherited from class org.htmlunit.html.DomNode

  `PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED`

  ### Fields inherited from interface org.w3c.dom.Node

  `ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HtmlPage(WebResponse webResponse, WebWindow webWindow)`
  Creates an instance of HtmlPage.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAutoCloseable(AutoCloseable autoCloseable)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Adds an `AutoCloseable`, which would be closed during the `cleanUp()`.
  `void`
  `addHtmlAttributeChangeListener(HtmlAttributeChangeListener listener)`
  Adds an HtmlAttributeChangeListener to the listener list.
  `Node`
  `adoptNode(Node source)`
  Not yet implemented.
  `protected void`
  `checkChildHierarchy(Node newChild)`
  Check for insertion errors for a new child node.
  `void`
  `cleanUp()`
  Clean up this page.
  `void`
  `clearComputedStyles()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Clears the computed styles.
  `void`
  `clearComputedStyles(DomElement element)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Clears the computed styles for a specific `Element`.
  `void`
  `clearComputedStylesUpToRoot(DomElement element)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Clears the computed styles for a specific `Element` and all parent elements.
  `protected HtmlPage`
  `clone()`
  Creates a clone of this instance, and clears cached state to be not shared with the original.
  `HtmlPage`
  `cloneNode(boolean deep)`
  `Attr`
  `createAttributeNS(String namespaceURI, String qualifiedName)`
  Not yet implemented.
  `DomElement`
  `createElement(String tagName)`
  `DomElement`
  `createElementNS(String namespaceURI, String qualifiedName)`
  `EntityReference`
  `createEntityReference(String id)`
  Not yet implemented.
  `ProcessingInstruction`
  `createProcessingInstruction(String namespaceURI, String qualifiedName)`
  Not yet implemented.
  `void`
  `deregisterFramesIfNeeded()`
  Deregister frames that are no longer in use.
  `ScriptResult`
  `executeJavaScript(String sourceCode)`
  Executes the specified JavaScript code within the page.
  `ScriptResult`
  `executeJavaScript(String sourceCode, String sourceName, int startLine)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `ScriptResult`
  `executeJavaScriptFunction(Object function, Object thisObject, Object[] args, DomNode htmlElementScope)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Execute a Function in the given context.
  `HtmlElement`
  `getActiveElement()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `HtmlAnchor`
  `getAnchorByHref(String href)`
  Returns the `HtmlAnchor` with the specified href.
  `HtmlAnchor`
  `getAnchorByName(String name)`
  Returns the `HtmlAnchor` with the specified name.
  `HtmlAnchor`
  `getAnchorByText(String text)`
  Returns the first anchor with the specified text.
  `List<HtmlAnchor>`
  `getAnchors()`
  Returns a list of all anchors contained in this page.
  `URL`
  `getBaseURL()`
  The base URL used to resolve relative URLs.
  `HtmlBody`
  `getBody()`
  `Charset`
  `getCharset()`
  Returns the encoding.
  `String`
  `getContentType()`
  Returns the content type of this page.
  `HtmlElement`
  `getDocumentElement()`
  Returns the document element.
  `String`
  `getDocumentURI()`
  Not yet implemented.
  `org.htmlunit.html.parser.HTMLParserDOMBuilder`
  `getDOMBuilder()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Returns the current builder.
  `DOMConfiguration`
  `getDomConfig()`
  Not yet implemented.
  `DomElement`
  `getElementById(String elementId)`
  `<E extends DomElement>
  E`
  `getElementByName(String name)`
  Returns the element with the specified name.
  `HtmlElement`
  `getElementFromPoint(int x, int y)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Returns the element for the specified x coordinate and the specified y coordinate.
  `List<DomElement>`
  `getElementsById(String elementId)`
  Returns the elements with the specified ID.
  `List<DomElement>`
  `getElementsByIdAndOrName(String idAndOrName)`
  Returns the elements with the specified string for their name or ID.
  `List<DomElement>`
  `getElementsByName(String name)`
  Returns the elements with the specified name attribute.
  `DomElement`
  `getFocusedElement()`
  Returns the element with the focus or null if no element has the focus.
  `HtmlForm`
  `getFormByName(String name)`
  Returns the first form that matches the specified name.
  `List<HtmlForm>`
  `getForms()`
  Returns a list of all the forms in this page.
  `FrameWindow`
  `getFrameByName(String name)`
  Returns the first frame contained in this page with the specified name.
  `List<FrameWindow>`
  `getFrames()`
  Returns a list containing all the frames (from frame and iframe tags) in this page in document order.
  `URL`
  `getFullyQualifiedUrl(String relativeUrl)`
  Given a relative URL (ie `/foo`), returns a fully-qualified URL based on the URL that was used to load this page.
  `HtmlElement`
  `getHead()`
  Returns the head element.
  `HtmlElement`
  `getHtmlElementByAccessKey(char accessKey)`
  Returns the HTML element that is assigned to the specified access key.
  `<E extends HtmlElement>
  E`
  `getHtmlElementById(String elementId)`
  Returns the HTML element with the specified ID.
  `List<HtmlElement>`
  `getHtmlElementsByAccessKey(char accessKey)`
  Returns all the HTML elements that are assigned to the specified access key.
  `DOMImplementation`
  `getImplementation()`
  Not yet implemented.
  `String`
  `getInputEncoding()`
  Not yet implemented.
  `protected List<HtmlMeta>`
  `getMetaTags(String httpEquiv)`
  Gets the meta tag for a given `http-equiv` value.
  `Map<String,String>`
  `getNamespaces()`
  Returns all namespaces defined in the root element of this page.
  `Document`
  `getOwnerDocument()`
  `HtmlPage`
  `getPage()`
  Returns the page that contains this node.
  `String`
  `getResolvedTarget(String elementTarget)`
  Given a target attribute value, resolve the target using a base target for the page.
  `List<org.htmlunit.html.impl.SimpleRange>`
  `getSelectionRanges()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `boolean`
  `getStrictErrorChecking()`
  Not yet implemented.
  `org.htmlunit.css.ComputedCssStyleDeclaration`
  `getStyleFromCache(DomElement element, String normalizedPseudo)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `List<org.htmlunit.css.CssStyleSheet>`
  `getStyleSheets()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `List<String>`
  `getTabbableElementIds()`
  Returns a list of ids (strings) that correspond to the tabbable elements in this page.
  `List<HtmlElement>`
  `getTabbableElements()`
  Returns a list of all elements that are tabbable in the order that will be used for tabbing.
  `String`
  `getTitleText()`
  Returns the title of this page or an empty string if the title wasn't specified.
  `String`
  `getXmlEncoding()`
  `boolean`
  `getXmlStandalone()`
  `String`
  `getXmlVersion()`
  `boolean`
  `handles(org.htmlunit.javascript.host.event.Event event)`
  Indicates if the provided event can be applied to this node.
  `boolean`
  `hasCaseSensitiveTagNames()`
  Returns `true` if this page has case-sensitive tag names, `false` otherwise.
  `Node`
  `importNode(Node importedNode, boolean deep)`
  Not yet implemented.
  `void`
  `initialize()`
  Initialize this page.
  `boolean`
  `isAttachedToPage()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Indicates if this node is currently attached to the page.
  `boolean`
  `isBeingParsed()`
  Returns `true` if an HTML parser is operating on this page, adding content to it.
  `boolean`
  `isHtmlPage()`
  Returns true if this page is an HtmlPage.
  `boolean`
  `isOnbeforeunloadAccepted()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `boolean`
  `isParsingHtmlSnippet()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Returns `true` if an HTML parser is parsing a non-inline HTML snippet to add content to this page.
  `boolean`
  `isParsingInlineHtmlSnippet()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Returns `true` if an HTML parser is parsing an inline HTML snippet to add content to this page.
  `boolean`
  `isQuirksMode()`
  Returns whether the current page mode is in `quirks mode` or in `standards mode`.
  `DomElement`
  `pressAccessKey(char accessKey)`
  Simulate pressing an access key.
  `void`
  `putStyleIntoCache(DomElement element, String normalizedPseudo, org.htmlunit.css.ComputedCssStyleDeclaration style)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Caches a CSS2Properties object.
  `Page`
  `refresh()`
  Refreshes the page by sending the same parameters as previously sent to get this page.
  `void`
  `registerInlineSnippetParsingEnd()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Called by the HTML parser to let the page know that it has finished parsing an inline HTML snippet.
  `void`
  `registerInlineSnippetParsingStart()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Called by the HTML parser to let the page know that it has started parsing an inline HTML snippet.
  `void`
  `registerParsingEnd()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Called by the HTML parser to let the page know that it has finished parsing some content for this page.
  `void`
  `registerParsingStart()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Called by the HTML parser to let the page know that it has started parsing some content for this page.
  `void`
  `registerSnippetParsingEnd()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Called by the HTML parser to let the page know that it has finished parsing a non-inline HTML snippet.
  `void`
  `registerSnippetParsingStart()`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Called by the HTML parser to let the page know that it has started parsing a non-inline HTML snippet.
  `void`
  `removeHtmlAttributeChangeListener(HtmlAttributeChangeListener listener)`
  Removes an HtmlAttributeChangeListener from the listener list.
  `Node`
  `renameNode(Node newNode, String namespaceURI, String qualifiedName)`
  Not yet implemented.
  `void`
  `save(File file)`
  Saves the current page, with all images, to the specified location.
  `void`
  `setDocumentType(DocumentType type)`
  Sets the document type.
  `void`
  `setDocumentURI(String documentURI)`
  Not yet implemented.
  `void`
  `setDOMBuilder(org.htmlunit.html.parser.HTMLParserDOMBuilder htmlUnitDOMBuilder)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Sets the builder to allow page to send content from document.write(ln) calls.
  `void`
  `setElementFromPointHandler(ElementFromPointHandler elementFromPointHandler)`
  Sets the `ElementFromPointHandler`.
  `void`
  `setElementWithFocus(DomElement elementWithFocus)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `boolean`
  `setFocusedElement(DomElement newElement)`
  Moves the focus to the specified element.
  `boolean`
  `setFocusedElement(DomElement newElement, boolean windowActivated)`
  Moves the focus to the specified element.
  `void`
  `setNodeValue(String value)`
  `void`
  `setPrefix(String prefix)`
  `void`
  `setSelectionRange(org.htmlunit.html.impl.SimpleRange selectionRange)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  `void`
  `setStrictErrorChecking(boolean strictErrorChecking)`
  Not yet implemented.
  `void`
  `setTitleText(String message)`
  Sets the text for the title of this page.
  `void`
  `setXmlStandalone(boolean xmlStandalone)`
  Not yet implemented.
  `void`
  `setXmlVersion(String xmlVersion)`
  Not yet implemented.
  `HtmlElement`
  `tabToNextElement()`
  Move the focus to the next element in the tab order.
  `HtmlElement`
  `tabToPreviousElement()`
  Move the focus to the previous element in the tab order.
  `String`
  `toString()`
  Gives a basic representation for debugging purposes.
  `void`
  `writeInParsedStream(String string)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

  ### Methods inherited from class org.htmlunit.SgmlPage

  `asXml, characterDataChangeListenerAdded, createAttribute, createCDATASection, createComment, createDocumentFragment, createNodeIterator, createTextNode, domChangeListenerAdded, getCanonicalXPath, getDoctype, getElementsByTagName, getElementsByTagNameNS, getEnclosingWindow, getNodeName, getNodeType, getUrl, getWebClient, getWebResponse, isCharacterDataChangeListenerInUse, isDomChangeListenerInUse, isPrinting, normalizeDocument, setEnclosingWindow, setPrinting`

  ### Methods inherited from class org.htmlunit.html.DomNode

  `addCharacterDataChangeListener, addDomChangeListener, appendChild, asNormalizedText, basicRemove, closest, compareDocumentPosition, detach, fireCharacterDataChanged, fireNodeAdded, fireNodeDeleted, getAncestors, getAttributes, getBaseURI, getByXPath, getByXPath, getChildNodes, getChildren, getDescendants, getDomElementDescendants, getEndColumnNumber, getEndLineNumber, getFeature, getFirstByXPath, getFirstByXPath, getFirstChild, getHtmlElementDescendants, getHtmlPageOrNull, getIndex, getLastChild, getLocalName, getNamespaceURI, getNextElementSibling, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousElementSibling, getPreviousSibling, getReadyState, getScriptableObject, getSelectorList, getStartColumnNumber, getStartLineNumber, getTextContent, getUserData, getVisibleText, hasAttributes, hasChildNodes, hasFeature, insertBefore, insertBefore, isAncestorOf, isAncestorOfAny, isDefaultNamespace, isDisplayed, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, mayBeDisplayed, normalize, notifyIncorrectness, onAddedToDocumentFragment, onAddedToPage, onAllChildrenAddedToPage, parseHtmlSnippet, printChildrenAsXml, printXml, processImportNode, querySelector, querySelectorAll, quietlyRemoveAndMoveChildrenTo, remove, removeAllChildren, removeCharacterDataChangeListener, removeChild, removeDomChangeListener, replace, replaceChild, setEndLocation, setParentNode, setReadyState, setScriptableObject, setStartLocation, setTextContent, setUserData`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.w3c.dom.Node

  `appendChild, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setTextContent, setUserData`

- ## Constructor Details

  - ### HtmlPage

    public HtmlPage(WebResponse webResponse, WebWindow webWindow)
    Creates an instance of HtmlPage. An HtmlPage instance is normally retrieved with `WebClient.getPage(String)`.
    Parameters:
      `webResponse` - the web response that was used to create this page
      `webWindow` - the window that this page is being loaded into

- ## Method Details

  - ### getPage

    public HtmlPage getPage()
    Returns the page that contains this node.
    Overrides:
      `getPage` in class `SgmlPage`
    Returns:
      the page that contains this node

  - ### hasCaseSensitiveTagNames

    public boolean hasCaseSensitiveTagNames()
    Returns `true` if this page has case-sensitive tag names, `false` otherwise. In general, XML has case-sensitive tag names, and HTML doesn't. This is especially important during XPath matching.
    Specified by:
      `hasCaseSensitiveTagNames` in class `SgmlPage`
    Returns:
      `true` if this page has case-sensitive tag names, `false` otherwise

  - ### initialize

    public void initialize() throws IOException, FailingHttpStatusCodeException
    Initialize this page.
    Throws:
      `IOException` - if an IO problem occurs
      `FailingHttpStatusCodeException` - if the server returns a failing status code AND the property `WebClientOptions.setThrowExceptionOnFailingStatusCode(boolean)` is set to true.

  - ### cleanUp

    public void cleanUp()
    Clean up this page.
    Specified by:
      `cleanUp` in interface `Page`
    Overrides:
      `cleanUp` in class `SgmlPage`

  - ### getDocumentElement

    public HtmlElement getDocumentElement()
    Returns the document element.
    Specified by:
      `getDocumentElement` in interface `Document`
    Overrides:
      `getDocumentElement` in class `SgmlPage`
    Returns:
      the document element

  - ### getBody

    public HtmlBody getBody()
    Returns:
      the `body` element, or `null` if it does not yet exist

  - ### getHead

    public HtmlElement getHead()
    Returns the head element.
    Returns:
      the head element

  - ### getOwnerDocument

    public Document getOwnerDocument()
    Specified by:
      `getOwnerDocument` in interface `Node`
    Overrides:
      `getOwnerDocument` in class `DomNode`

  - ### importNode

    public Node importNode(Node importedNode, boolean deep)
    Not yet implemented.

  - ### getInputEncoding

    public String getInputEncoding()
    Not yet implemented.

  - ### getXmlEncoding

    public String getXmlEncoding()

  - ### getXmlStandalone

    public boolean getXmlStandalone()

  - ### setXmlStandalone

    public void setXmlStandalone(boolean xmlStandalone) throws DOMException
    Not yet implemented.
    Throws:
      `DOMException`

  - ### getXmlVersion

    public String getXmlVersion()

  - ### setXmlVersion

    public void setXmlVersion(String xmlVersion) throws DOMException
    Not yet implemented.
    Throws:
      `DOMException`

  - ### getStrictErrorChecking

    public boolean getStrictErrorChecking()
    Not yet implemented.

  - ### setStrictErrorChecking

    public void setStrictErrorChecking(boolean strictErrorChecking)
    Not yet implemented.

  - ### getDocumentURI

    public String getDocumentURI()
    Not yet implemented.

  - ### setDocumentURI

    public void setDocumentURI(String documentURI)
    Not yet implemented.

  - ### adoptNode

    public Node adoptNode(Node source) throws DOMException
    Not yet implemented.
    Throws:
      `DOMException`

  - ### getDomConfig

    public DOMConfiguration getDomConfig()
    Not yet implemented.

  - ### renameNode

    public Node renameNode(Node newNode, String namespaceURI, String qualifiedName) throws DOMException
    Not yet implemented.
    Throws:
      `DOMException`

  - ### getCharset

    public Charset getCharset()
    Returns the encoding.
    Specified by:
      `getCharset` in class `SgmlPage`
    Returns:
      the encoding

  - ### getContentType

    public String getContentType()
    Returns the content type of this page.
    Specified by:
      `getContentType` in class `SgmlPage`
    Returns:
      the content type of this page

  - ### getImplementation

    public DOMImplementation getImplementation()
    Not yet implemented.

  - ### createElement

    public DomElement createElement(String tagName)
    Parameters:
      `tagName` - the tag name, preferably in lowercase

  - ### createElementNS

    public DomElement createElementNS(String namespaceURI, String qualifiedName)

  - ### createAttributeNS

    public Attr createAttributeNS(String namespaceURI, String qualifiedName)
    Not yet implemented.

  - ### createEntityReference

    public EntityReference createEntityReference(String id)
    Not yet implemented.

  - ### createProcessingInstruction

    public ProcessingInstruction createProcessingInstruction(String namespaceURI, String qualifiedName)
    Not yet implemented.

  - ### getElementById

    public DomElement getElementById(String elementId)

  - ### getAnchorByName

    public HtmlAnchor getAnchorByName(String name) throws ElementNotFoundException
    Returns the `HtmlAnchor` with the specified name.
    Parameters:
      `name` - the name to search by
    Returns:
      the `HtmlAnchor` with the specified name
    Throws:
      `ElementNotFoundException` - if the anchor could not be found

  - ### getAnchorByHref

    public HtmlAnchor getAnchorByHref(String href) throws ElementNotFoundException
    Returns the `HtmlAnchor` with the specified href.
    Parameters:
      `href` - the string to search by
    Returns:
      the HtmlAnchor
    Throws:
      `ElementNotFoundException` - if the anchor could not be found

  - ### getAnchors

    public List<HtmlAnchor> getAnchors()
    Returns a list of all anchors contained in this page.
    Returns:
      the list of `HtmlAnchor` in this page

  - ### getAnchorByText

    public HtmlAnchor getAnchorByText(String text) throws ElementNotFoundException
    Returns the first anchor with the specified text.
    Parameters:
      `text` - the text to search for
    Returns:
      the first anchor that was found
    Throws:
      `ElementNotFoundException` - if no anchors are found with the specified text

  - ### getFormByName

    public HtmlForm getFormByName(String name) throws ElementNotFoundException
    Returns the first form that matches the specified name.
    Parameters:
      `name` - the name to search for
    Returns:
      the first form
    Throws:
      `ElementNotFoundException` - If no forms match the specified result.

  - ### getForms

    public List<HtmlForm> getForms()
    Returns a list of all the forms in this page.
    Returns:
      all the forms in this page

  - ### getFullyQualifiedUrl

    public URL getFullyQualifiedUrl(String relativeUrl) throws MalformedURLException
    Given a relative URL (ie `/foo`), returns a fully-qualified URL based on the URL that was used to load this page.
    Parameters:
      `relativeUrl` - the relative URL
    Returns:
      the fully-qualified URL for the specified relative URL
    Throws:
      `MalformedURLException` - if an error occurred when creating a URL object

  - ### getResolvedTarget

    public String getResolvedTarget(String elementTarget)
    Given a target attribute value, resolve the target using a base target for the page.
    Parameters:
      `elementTarget` - the target specified as an attribute of the element
    Returns:
      the resolved target to use for the element

  - ### getTabbableElementIds

    public List<String> getTabbableElementIds()
    Returns a list of ids (strings) that correspond to the tabbable elements in this page. Return them in the same order specified in `getTabbableElements()`
    Returns:
      the list of id's

  - ### getTabbableElements

    public List<HtmlElement> getTabbableElements()
    Returns a list of all elements that are tabbable in the order that will be used for tabbing.

    The rules for determining tab order are as follows:

    1. Those elements that support the tabindex attribute and assign a positive value to it are navigated first. Navigation proceeds from the element with the lowest tabindex value to the element with the highest value. Values need not be sequential nor must they begin with any particular value. Elements that have identical tabindex values should be navigated in the order they appear in the character stream.
    2. Those elements that do not support the tabindex attribute or support it and assign it a value of "0" are navigated next. These elements are navigated in the order they appear in the character stream.
    3. Elements that are disabled do not participate in the tabbing order.
    Additionally, the value of tabindex must be within 0 and 32767. Any values outside this range will be ignored.

    The following elements support the `tabindex` attribute: A, AREA, BUTTON, INPUT, OBJECT, SELECT, and TEXTAREA.

    Returns:
      all the tabbable elements in proper tab order

  - ### getHtmlElementByAccessKey

    public HtmlElement getHtmlElementByAccessKey(char accessKey)
    Returns the HTML element that is assigned to the specified access key. An access key (aka mnemonic key) is used for keyboard navigation of the page.

    Only the following HTML elements may have `accesskey`s defined: A, AREA, BUTTON, INPUT, LABEL, LEGEND, and TEXTAREA.

    Parameters:
      `accessKey` - the key to look for
    Returns:
      the HTML element that is assigned to the specified key or null if no elements can be found that match the specified key.

  - ### getHtmlElementsByAccessKey

    public List<HtmlElement> getHtmlElementsByAccessKey(char accessKey)
    Returns all the HTML elements that are assigned to the specified access key. An access key (aka mnemonic key) is used for keyboard navigation of the page.

    The HTML specification seems to indicate that one accesskey cannot be used for multiple elements however Internet Explorer does seem to support this. It's worth noting that Firefox does not support multiple elements with one access key so you are making your HTML browser specific if you rely on this feature.

    Only the following HTML elements may have `accesskey`s defined: A, AREA, BUTTON, INPUT, LABEL, LEGEND, and TEXTAREA.

    Parameters:
      `accessKey` - the key to look for
    Returns:
      the elements that are assigned to the specified accesskey

  - ### executeJavaScript

    public ScriptResult executeJavaScript(String sourceCode)

    Executes the specified JavaScript code within the page. The usage would be similar to what can be achieved to execute JavaScript in the current page by entering "javascript:...some JS code..." in the URL field of a native browser.

    Note: the provided code won't be executed if JavaScript has been disabled on the WebClient (see `WebClient.isJavaScriptEnabled()`.

    Parameters:
      `sourceCode` - the JavaScript code to execute
    Returns:
      a ScriptResult which will contain both the current page (which may be different than the previous page) and a JavaScript result object

  - ### executeJavaScript

    public ScriptResult executeJavaScript(String sourceCode, String sourceName, int startLine)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Execute the specified JavaScript if a JavaScript engine was successfully instantiated. If this JavaScript causes the current page to be reloaded (through location="" or form.submit()) then return the new page. Otherwise return the current page.

    Please note: Although this method is public, it is not intended for general execution of JavaScript. Users of HtmlUnit should interact with the pages as a user would by clicking on buttons or links and having the JavaScript event handlers execute as needed..

    Parameters:
      `sourceCode` - the JavaScript code to execute
      `sourceName` - the name for this chunk of code (will be displayed in error messages)
      `startLine` - the line at which the script source starts
    Returns:
      a ScriptResult which will contain both the current page (which may be different than the previous page and a JavaScript result object.

  - ### getTitleText

    public String getTitleText()
    Returns the title of this page or an empty string if the title wasn't specified.
    Returns:
      the title of this page or an empty string if the title wasn't specified

  - ### setTitleText

    public void setTitleText(String message)
    Sets the text for the title of this page. If there is not a title element on this page, then one has to be generated.
    Parameters:
      `message` - the new text

  - ### isOnbeforeunloadAccepted

    public boolean isOnbeforeunloadAccepted()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns:
      true if the OnbeforeunloadHandler has accepted to change the page

  - ### deregisterFramesIfNeeded

    public void deregisterFramesIfNeeded()
    Deregister frames that are no longer in use.

  - ### getFrames

    public List<FrameWindow> getFrames()
    Returns a list containing all the frames (from frame and iframe tags) in this page in document order.
    Returns:
      a list of `FrameWindow`

  - ### getFrameByName

    public FrameWindow getFrameByName(String name) throws ElementNotFoundException
    Returns the first frame contained in this page with the specified name.
    Parameters:
      `name` - the name to search for
    Returns:
      the first frame found
    Throws:
      `ElementNotFoundException` - If no frame exist in this page with the specified name.

  - ### pressAccessKey

    public DomElement pressAccessKey(char accessKey) throws IOException
    Simulate pressing an access key. This may change the focus, may click buttons and may invoke JavaScript.
    Parameters:
      `accessKey` - the key that will be pressed
    Returns:
      the element that has the focus after pressing this access key or null if no element has the focus.
    Throws:
      `IOException` - if an IO error occurs during the processing of this access key (this would only happen if the access key triggered a button which in turn caused a page load)

  - ### tabToNextElement

    public HtmlElement tabToNextElement()
    Move the focus to the next element in the tab order. To determine the specified tab order, refer to `getTabbableElements()`
    Returns:
      the element that has focus after calling this method

  - ### tabToPreviousElement

    public HtmlElement tabToPreviousElement()
    Move the focus to the previous element in the tab order. To determine the specified tab order, refer to `getTabbableElements()`
    Returns:
      the element that has focus after calling this method

  - ### getHtmlElementById

    public <E extends HtmlElement> E getHtmlElementById(String elementId) throws ElementNotFoundException
    Returns the HTML element with the specified ID. If more than one element has this ID (not allowed by the HTML spec), then this method returns the first one.
    Type Parameters:
      `E` - the element type
    Parameters:
      `elementId` - the ID value to search for
    Returns:
      the HTML element with the specified ID
    Throws:
      `ElementNotFoundException` - if no element was found matching the specified ID

  - ### getElementsById

    public List<DomElement> getElementsById(String elementId)
    Returns the elements with the specified ID. If there are no elements with the specified ID, this method returns an empty list. Please note that the lists returned by this method are immutable.
    Parameters:
      `elementId` - the ID value to search for
    Returns:
      the elements with the specified name attribute

  - ### getElementByName

    public <E extends DomElement> E getElementByName(String name) throws ElementNotFoundException
    Returns the element with the specified name. If more than one element has this name, then this method returns the first one.
    Type Parameters:
      `E` - the element type
    Parameters:
      `name` - the name value to search for
    Returns:
      the element with the specified name
    Throws:
      `ElementNotFoundException` - if no element was found matching the specified name

  - ### getElementsByName

    public List<DomElement> getElementsByName(String name)
    Returns the elements with the specified name attribute. If there are no elements with the specified name, this method returns an empty list. Please note that the lists returned by this method are immutable.
    Parameters:
      `name` - the name value to search for
    Returns:
      the elements with the specified name attribute

  - ### getElementsByIdAndOrName

    public List<DomElement> getElementsByIdAndOrName(String idAndOrName)
    Returns the elements with the specified string for their name or ID. If there are no elements with the specified name or ID, this method returns an empty list.
    Parameters:
      `idAndOrName` - the value to search for
    Returns:
      the elements with the specified string for their name or ID

  - ### toString

    public String toString()
    Gives a basic representation for debugging purposes.
    Overrides:
      `toString` in class `Object`
    Returns:
      a basic representation

  - ### getMetaTags

    protected List<HtmlMeta> getMetaTags(String httpEquiv)
    Gets the meta tag for a given `http-equiv` value.
    Parameters:
      `httpEquiv` - the `http-equiv` value
    Returns:
      a list of `HtmlMeta`

  - ### clone

    protected HtmlPage clone()
    Creates a clone of this instance, and clears cached state to be not shared with the original.
    Overrides:
      `clone` in class `SgmlPage`
    Returns:
      a clone of this instance

  - ### cloneNode

    public HtmlPage cloneNode(boolean deep)
    Specified by:
      `cloneNode` in interface `Node`
    Overrides:
      `cloneNode` in class `DomNode`

  - ### addHtmlAttributeChangeListener

    public void addHtmlAttributeChangeListener(HtmlAttributeChangeListener listener)
    Adds an HtmlAttributeChangeListener to the listener list. The listener is registered for all attributes of all HtmlElements contained in this page.
    Parameters:
      `listener` - the attribute change listener to be added
    See Also:
      - `removeHtmlAttributeChangeListener(HtmlAttributeChangeListener)`

  - ### removeHtmlAttributeChangeListener

    public void removeHtmlAttributeChangeListener(HtmlAttributeChangeListener listener)
    Removes an HtmlAttributeChangeListener from the listener list. This method should be used to remove HtmlAttributeChangeListener that were registered for all attributes of all HtmlElements contained in this page.
    Parameters:
      `listener` - the attribute change listener to be removed
    See Also:
      - `addHtmlAttributeChangeListener(HtmlAttributeChangeListener)`

  - ### checkChildHierarchy

    protected void checkChildHierarchy(Node newChild) throws DOMException
    Check for insertion errors for a new child node. This is overridden by derived classes to enforce which types of children are allowed.
    Overrides:
      `checkChildHierarchy` in class `DomNode`
    Parameters:
      `newChild` - the new child node that is being inserted below this node
    Throws:
      `DOMException` - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to insert a second DocumentType or Element node. WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.

  - ### isBeingParsed

    public boolean isBeingParsed()
    Returns `true` if an HTML parser is operating on this page, adding content to it.
    Returns:
      `true` if an HTML parser is operating on this page, adding content to it

  - ### registerParsingStart

    public void registerParsingStart()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Called by the HTML parser to let the page know that it has started parsing some content for this page.

  - ### registerParsingEnd

    public void registerParsingEnd()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Called by the HTML parser to let the page know that it has finished parsing some content for this page.

  - ### isParsingHtmlSnippet

    public boolean isParsingHtmlSnippet()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns `true` if an HTML parser is parsing a non-inline HTML snippet to add content to this page. Non-inline content is content that is parsed for the page, but not in the same stream as the page itself -- basically anything other than `document.write()` or `document.writeln()`: `innerHTML`, `outerHTML`, `document.createElement()`, etc.
    Returns:
      `true` if an HTML parser is parsing a non-inline HTML snippet to add content to this page

  - ### registerSnippetParsingStart

    public void registerSnippetParsingStart()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Called by the HTML parser to let the page know that it has started parsing a non-inline HTML snippet.

  - ### registerSnippetParsingEnd

    public void registerSnippetParsingEnd()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Called by the HTML parser to let the page know that it has finished parsing a non-inline HTML snippet.

  - ### isParsingInlineHtmlSnippet

    public boolean isParsingInlineHtmlSnippet()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns `true` if an HTML parser is parsing an inline HTML snippet to add content to this page. Inline content is content inserted into the parser stream dynamically while the page is being parsed (i.e. `document.write()` or `document.writeln()`).
    Returns:
      `true` if an HTML parser is parsing an inline HTML snippet to add content to this page

  - ### registerInlineSnippetParsingStart

    public void registerInlineSnippetParsingStart()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Called by the HTML parser to let the page know that it has started parsing an inline HTML snippet.

  - ### registerInlineSnippetParsingEnd

    public void registerInlineSnippetParsingEnd()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Called by the HTML parser to let the page know that it has finished parsing an inline HTML snippet.

  - ### refresh

    public Page refresh() throws IOException
    Refreshes the page by sending the same parameters as previously sent to get this page.
    Returns:
      the newly loaded page.
    Throws:
      `IOException` - if an IO problem occurs

  - ### writeInParsedStream

    public void writeInParsedStream(String string)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Parses the given string as would it belong to the content being parsed at the current parsing position

    Parameters:
      `string` - the HTML code to write in place

  - ### setDOMBuilder

    public void setDOMBuilder(org.htmlunit.html.parser.HTMLParserDOMBuilder htmlUnitDOMBuilder)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Sets the builder to allow page to send content from document.write(ln) calls.
    Parameters:
      `htmlUnitDOMBuilder` - the builder

  - ### getDOMBuilder

    public org.htmlunit.html.parser.HTMLParserDOMBuilder getDOMBuilder()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns the current builder.
    Returns:
      the current builder

  - ### getNamespaces

    public Map<String,String> getNamespaces()

    Returns all namespaces defined in the root element of this page.

    The default namespace has a key of an empty string.

    Returns:
      all namespaces defined in the root element of this page

  - ### setDocumentType

    public void setDocumentType(DocumentType type)
    Sets the document type.
    Overrides:
      `setDocumentType` in class `SgmlPage`
    Parameters:
      `type` - the document type

  - ### save

    public void save(File file) throws IOException
    Saves the current page, with all images, to the specified location. The default behavior removes all script elements.
    Parameters:
      `file` - file to write this page into
    Throws:
      `IOException` - If an error occurs

  - ### isQuirksMode

    public boolean isQuirksMode()
    Returns whether the current page mode is in `quirks mode` or in `standards mode`.
    Returns:
      true for `quirks mode`, false for `standards mode`

  - ### isAttachedToPage

    public boolean isAttachedToPage()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Indicates if this node is currently attached to the page.
    Overrides:
      `isAttachedToPage` in class `DomNode`
    Returns:
      `true` if the page is one ancestor of the node.

  - ### isHtmlPage

    public boolean isHtmlPage()
    Returns true if this page is an HtmlPage.
    Specified by:
      `isHtmlPage` in interface `Page`
    Overrides:
      `isHtmlPage` in class `SgmlPage`
    Returns:
      true or false

  - ### getBaseURL

    public URL getBaseURL()
    The base URL used to resolve relative URLs.
    Returns:
      the base URL

  - ### addAutoCloseable

    public void addAutoCloseable(AutoCloseable autoCloseable)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Adds an `AutoCloseable`, which would be closed during the `cleanUp()`.
    Parameters:
      `autoCloseable` - the autoclosable

  - ### handles

    public boolean handles(org.htmlunit.javascript.host.event.Event event)
    Indicates if the provided event can be applied to this node. Overwrite this.
    Overrides:
      `handles` in class `DomNode`
    Parameters:
      `event` - the event
    Returns:
      `false` if the event can't be applied

  - ### setElementFromPointHandler

    public void setElementFromPointHandler(ElementFromPointHandler elementFromPointHandler)
    Sets the `ElementFromPointHandler`.
    Parameters:
      `elementFromPointHandler` - the handler

  - ### getElementFromPoint

    public HtmlElement getElementFromPoint(int x, int y)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns the element for the specified x coordinate and the specified y coordinate.
    Parameters:
      `x` - the x offset, in pixels
      `y` - the y offset, in pixels
    Returns:
      the element for the specified x coordinate and the specified y coordinate

  - ### setFocusedElement

    public boolean setFocusedElement(DomElement newElement)
    Moves the focus to the specified element. This will trigger any relevant JavaScript event handlers.
    Parameters:
      `newElement` - the element that will receive the focus, use `null` to remove focus from any element
    Returns:
      true if the specified element now has the focus
    See Also:
      - `getFocusedElement()`

  - ### setFocusedElement

    public boolean setFocusedElement(DomElement newElement, boolean windowActivated)
    Moves the focus to the specified element. This will trigger any relevant JavaScript event handlers.
    Parameters:
      `newElement` - the element that will receive the focus, use `null` to remove focus from any element
      `windowActivated` - - whether the enclosing window got focus resulting in specified element getting focus
    Returns:
      true if the specified element now has the focus
    See Also:
      - `getFocusedElement()`

  - ### getFocusedElement

    public DomElement getFocusedElement()
    Returns the element with the focus or null if no element has the focus.
    Returns:
      the element with focus or null
    See Also:
      - `setFocusedElement(DomElement)`

  - ### setElementWithFocus

    public void setElementWithFocus(DomElement elementWithFocus)

    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Sets the element with focus.
    Parameters:
      `elementWithFocus` - the element with focus

  - ### getActiveElement

    public HtmlElement getActiveElement()

    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Returns:
      the element with focus or the body

  - ### getSelectionRanges

    public List<org.htmlunit.html.impl.SimpleRange> getSelectionRanges()

    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Returns the page's current selection ranges.

    Returns:
      the page's current selection ranges

  - ### setSelectionRange

    public void setSelectionRange(org.htmlunit.html.impl.SimpleRange selectionRange)

    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.

    Makes the specified selection range the *only* selection range on this page.

    Parameters:
      `selectionRange` - the selection range

  - ### executeJavaScriptFunction

    public ScriptResult executeJavaScriptFunction(Object function, Object thisObject, Object[] args, DomNode htmlElementScope)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Execute a Function in the given context.
    Parameters:
      `function` - the JavaScript Function to call
      `thisObject` - the "this" object to be used during invocation
      `args` - the arguments to pass into the call
      `htmlElementScope` - the HTML element for which this script is being executed This element will be the context during the JavaScript execution. If null, the context will default to the page.
    Returns:
      a ScriptResult which will contain both the current page (which may be different than the previous page and a JavaScript result object.

  - ### setNodeValue

    public void setNodeValue(String value)

  - ### setPrefix

    public void setPrefix(String prefix)

  - ### clearComputedStyles

    public void clearComputedStyles()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Clears the computed styles.
    Overrides:
      `clearComputedStyles` in class `SgmlPage`

  - ### clearComputedStyles

    public void clearComputedStyles(DomElement element)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Clears the computed styles for a specific `Element`.
    Overrides:
      `clearComputedStyles` in class `SgmlPage`
    Parameters:
      `element` - the element to clear its cache

  - ### clearComputedStylesUpToRoot

    public void clearComputedStylesUpToRoot(DomElement element)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Clears the computed styles for a specific `Element` and all parent elements.
    Overrides:
      `clearComputedStylesUpToRoot` in class `SgmlPage`
    Parameters:
      `element` - the element to clear its cache

  - ### getStyleFromCache

    public org.htmlunit.css.ComputedCssStyleDeclaration getStyleFromCache(DomElement element, String normalizedPseudo)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Parameters:
      `element` - the element to clear its cache
      `normalizedPseudo` - the pseudo attribute
    Returns:
      the cached CSS2Properties object or null

  - ### putStyleIntoCache

    public void putStyleIntoCache(DomElement element, String normalizedPseudo, org.htmlunit.css.ComputedCssStyleDeclaration style)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Caches a CSS2Properties object.
    Parameters:
      `element` - the element to clear its cache
      `normalizedPseudo` - the pseudo attribute
      `style` - the CSS2Properties to cache

  - ### getStyleSheets

    public List<org.htmlunit.css.CssStyleSheet> getStyleSheets()
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Returns:
      a list of all styles from this page (<style> and <link rel=stylesheet>). This returns an empty list if css support is disabled in the web client options.