question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

waitForLoadState waitUntil domcontentloaded doesn't wait

See original GitHub issue

Sorry if I am misusing the method.

await page.waitForLoadState({ waitUntil: "domcontentloaded" });
let elementHandle = await page.$('input[name="username"]');
await elementHandle.type(USER_DETAILS.username); <- crashes as elementHandle is null

but

await page.waitFor('input[name="username"]');
let elementHandle = await page.$('input[name="username"]');
await elementHandle.type(USER_DETAILS.username); <- works fine

Thanks a lot!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

16reactions
Pomaxcommented, May 17, 2021

is there a link to that stretch feature? Because I’m running into the lack of “wait for DOM to be stable” and it makes running visual diffing considerably harder than it needs to be because neither networkidle nor domcontentready are useful for modern sites that use React or Vue or the like. For those, the networkidle/domcontentready events in fact signal the start of the DOM mutation process, rather than any “this page is now stable” event, in effect being the exact opposite of a useful signal =)

4reactions
guzzurcommented, Jan 28, 2020

But even i await page.goto(...), I am getting these still-loading screenshots. Doesn’t that mean the domcontentloaded haven’t fired yet?

How can I ensure that the page is fully loaded before I continue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Playwright: how to wait until there is no animation on the page?
There are several options that may help you. 1. Solution 1: First, you can maybe determine which element is loading last, and then...
Read more >
Avoiding hard waits in Playwright and Puppeteer
We try to solve this issue with a hard wait, like Puppeteer's page. ... waitForNavigation to wait until a page navigation (new URL...
Read more >
Navigating & waiting - Checkly
Navigating to some web page; Waiting for something; Possibly getting a timeout ... Both options 2a and 2b are passed using the waitUntil...
Read more >
How to make puppeteer wait for page to load - Urlbox
It fires when the initial HTML document's DOM has been loaded and parsed. However, this does NOT wait for stylesheets, images, ...
Read more >
playwright/page-wait-for-load-state.spec.ts at ... - Gitnet
await page.goto(server.PREFIX + '/one-style.html', {waitUntil: 'domcontentloaded'});. await page.waitForLoadState('domcontentloaded');.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found