Goto url and wait until page fully rendered
See original GitHub issueHi, me again 😃
I’m currently trying to visit a webpage and wait for the page being rendered (including javascripts run) to find a specific image. I’ve seen this example in the docs (https://github.com/capricorn86/happy-dom/tree/master/packages/happy-dom), so I tried to go a similar way:
function visitUrl(url: string): Promise<AsyncWindow> {
// ...
const window = new AsyncWindow();
window.location.href = url;
window.happyDOM.whenAsyncComplete().then(() => {
console.log('innerHTML', window.document.body.innerHTML);
resolve(window);
});
}
// resolves directly with empty innerHTML:
const window = await visitUrl('https://page-to-visit.com');
const img = window.document.querySelector('img');
The console log only shows innerHTML
, so I assume there’s either something wrong with my code, or there might be a bug with happy-dom. Do you know what’s the issue here? Is there maybe any “load”-event I can listen to?
- Maybe it could also be useful to have this use case in the docs 😃
Thanks in advance, keep up the great work!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Puppeteer wait until page is completely loaded - Stack Overflow
You can use page.waitForNavigation() to wait for the new page to load completely before generating a PDF: await page.goto(fullUrl, ...
Read more >How to make puppeteer wait for page to load - Urlbox
waitUntil : load. The load option fires when the whole page has loaded, including all dependent resources such as stylesheets, fonts and images....
Read more >Navigating & waiting - Checkly
You can use Puppeteer's page.waitForNavigation() method here to explicitly wait for this event to happen and then continue your script. The accepted notation...
Read more >Wait For The Page And Elements To Fully Render Before ...
This video shows how I wait for the page to fully load by observing the new elements that appear during the tests, and...
Read more >Puppeteer, wait until the page is ready! - ScreenshotOne
In order to take a screenshot when the page is fully loaded and rendered, one of the most working combination is to set...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you @JulianLang! 🙂
Thanks a lot for helping, will try it the next days 😃