Answer the question
In order to leave comments, you need to log in
How to return JSDOM rendered page?
I'm trying to use the JSDOM package to load a page and execute scripts on it, and then return the result.
Here is the code I am using.
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const dom = new JSDOM(``, {
url: "https://example.com",
referrer: "https://example.com",
contentType: "text/html",
includeNodeLocations: true,
storageQuota: 10000000,
runScripts: "dangerously",
resources: "usable"
});
console.log(dom);
JSDOM {
[Symbol(window)]:
Window {
onafterprint: [Getter/Setter],
onbeforeprint: [Getter/Setter],
onbeforeunload: [Getter/Setter],
onhashchange: [Getter/Setter],
onlanguagechange: [Getter/Setter] ,
onmessage: [Getter/Setter],
onmessageerror: [Getter/Setter],
onoffline: [Getter/Setter],
ononline: [Getter/Setter],
onpagehide: [Getter/Setter],
onpageshow: [Getter/Setter],
onpopstate : [Getter/Setter],
onrejectionhandled: [Getter/Setter],
onstorage: [Getter/Setter],
onunhandledrejection: [Getter/Setter],
onunload: [Getter/Setter],
onblur: [Getter/Setter],
onerror: [Getter/Setter],
onfocus: [Getter/Setter],
onload: [Getter/Setter],
...
Answer the question
In order to leave comments, you need to log in
If you don’t want to read the docs, then at least look at the examples carefully at your own link.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question