Package com.github.loyada.jdollarx.utils
Class DebugUtil
- java.lang.Object
-
- com.github.loyada.jdollarx.utils.DebugUtil
-
public final class DebugUtil extends Object
Several utilities that are useful for troubleshooting of existing browser pages. The utilities assume the use ofInBrowserSinglton
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<org.jsoup.nodes.Element>
getDOM(Path el)
Same asgetDOMOfAll(Path)
, but returns an optional of the first match.static List<org.jsoup.nodes.Element>
getDOMOfAll(Path el)
Get all matches of the path as a list ofElement
.static Document
getPageAsW3CDoc()
Download the current page and convert it to a W3C Document, which can be inspected using thePathParsers
methodsstatic void
highlight(Path el)
Highlight the first element that match the path in the browser, for 2 seconds.static void
highlightAll(Path el)
Highlight all the elements that match the path in the browser, for 2 seconds.
-
-
-
Method Detail
-
getDOMOfAll
public static List<org.jsoup.nodes.Element> getDOMOfAll(Path el)
Get all matches of the path as a list ofElement
. JSoupElement
are a nice, readable way to examine DOM objects. This is useful for troubleshooting. This method relies onInBrowserSinglton
, 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 asgetDOMOfAll(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 thePathParsers
methods- Returns:
- a W3C document
-
-