Class DebugUtil


  • public final class DebugUtil
    extends Object
    Several utilities that are useful for troubleshooting of existing browser pages. The utilities assume the use of InBrowserSinglton.
    • Method Detail

      • getDOMOfAll

        public static List<org.jsoup.nodes.Element> getDOMOfAll​(Path el)
        Get all matches of the path as a list of Element. JSoup Element are a nice, readable way to examine DOM objects. This is useful for troubleshooting. This method relies on InBrowserSinglton, and on the library JSoup.
        Parameters:
        el - the path we are looking for
        Returns:
        all the elements that match it in the current page
      • getDOM

        public static Optional<org.jsoup.nodes.Element> getDOM​(Path el)
        Same as getDOMOfAll(Path), but returns an optional of the first match.
        Parameters:
        el - the path we are looking for
        Returns:
        the first Element that matches the path in the current page
      • highlight

        public static void highlight​(Path el)
        Highlight the first element that match the path in the browser, for 2 seconds.
        Parameters:
        el - - the definition of the element to highlight
      • highlightAll

        public static void highlightAll​(Path el)
        Highlight all the elements that match the path in the browser, for 2 seconds.
        Parameters:
        el - - the definition of the elements to highlight
      • getPageAsW3CDoc

        public static Document getPageAsW3CDoc()
        Download the current page and convert it to a W3C Document, which can be inspected using the PathParsers methods
        Returns:
        a W3C document