browser_dom: Execute JavaScript on an HTML page via a headless browser and dump the DOM
Description
Load an HTML page in a headless browser (Chromium/Chrome/Edge), execute all
JavaScript on it, and return (or save) the rendered DOM as HTML.
Usage
browser_dom(input, output = NULL, fragment = FALSE, browser = NULL)
Value
If output is NULL, the rendered HTML as a character string;
otherwise the output path (invisibly).
Arguments
input
Path or URL to the HTML page.
output
An optional output file path. If not provided, the rendered
HTML is returned as a character string.
fragment
Whether to return only the inner body content instead of the
full HTML document.
browser
Path to the web browser. By default, the browser is found via
xfun:::find_browser(). If it cannot be found, you may set the global
option options(xfun.browser = ) or environment variable R_XFUN_BROWSER
to the path of the browser, or simply pass the path to the browser
argument.