DebugUtil

public final class DebugUtil

Several utilities that are useful for troubleshooting of existing browser pages. The utilities assume the use of com.github.loyada.jdollarx.singlebrowser.InBrowserSinglton.

Methods

getDOM

public static Optional<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

getDOMOfAll

public static List<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 com.github.loyada.jdollarx.singlebrowser.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

getPageAsW3CDoc

public static org.w3c.dom.Document getPageAsW3CDoc()

Download the current page and convert it to a W3C Document, which can be inspected using the com.github.loyada.jdollarx.PathParsers methods

Returns:a W3C document

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