Class DomNodeUtil

    • Constructor Detail

      • DomNodeUtil

        public DomNodeUtil()
    • Method Detail

      • selectNodes

        public static <E> List<E> selectNodes​(org.htmlunit.html.DomNode domNode,
                                              String xpathExpr)
        Evaluates an XPath expression from the specified node, returning the resultant nodes.

        Calls WebClientUtil.waitForJSExec(WebClient) before executing the query.

        Parameters:
        domNode - the node to start searching from
        xpathExpr - the XPath expression
        Returns:
        the list of objects found.
      • selectSingleNode

        public static <X> X selectSingleNode​(org.htmlunit.html.DomNode domNode,
                                             String xpathExpr)
        Evaluates the specified XPath expression from this node, returning the first matching element, or null if no node matches the specified XPath expression.

        Calls WebClientUtil.waitForJSExec(WebClient) before executing the query.

        Parameters:
        domNode - the node to start searching from
        xpathExpr - the XPath expression
        Returns:
        the first element matching the specified XPath expression