library(testit) assert('browser_dom() executes JS, returns rendered DOM, and strips scripts', { f = tempfile(fileext = '.html') on.exit(unlink(f), add = TRUE) writeLines(c( '
', '', '' ), f) (unclass(browser_dom(f)) %==% 'static
', '', '' ), f) res = browser_dom(f, out) (res %==% out) (unclass(file_string(out)) %==% 'static
5
\n\n') }) assert('browser_dom(fragment = TRUE) returns body content only', { f = tempfile(fileext = '.html') on.exit(unlink(f), add = TRUE) writeLines('content\n
\t\n', f) res = browser_dom(f, fragment = TRUE) (unclass(res) %==% 'content\n
') })