Replies: 1 comment
-
|
Hi @Nashorn! It's also now possible to send in the callback to Example: import { Browser } from "happy-dom";
const browser = new Browser();
const page = browser.newPage();
await page.goto("https://example.com", {
beforeContentCallback: (window) => {
const script = window.document.createElement('script');
script.innerHTML = "console.log('Before content loaded')";
window.document.body.appendChild(script);
}
});
await browser.close(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to inject a preload script into the page as early as possible (DOMContentLoaded would be nice). Is BrowserPage.evaluate() the only way to do this?
Beta Was this translation helpful? Give feedback.
All reactions