News for hackers. Stuff that matters.
Re:Theheadless.dev – open source Puppeteer and Playwright kn... by umaar on Wednesday August 19, 2020 @08:10AM (#24209584)
Honestly, I'd completely avoid sleeps. I think it always comes back to bite you. In the end you need to learn and understand the context of the page to determine when the page has loaded.

When you say "wait for some DOM element", not sure what that refers to exactly, but how about using: `page.waitForSelector` and in addition, using the `visible: true` option?

It really depends on the page you're testing, feels like when I'm automating Wikipedia, I very rarely have to wait for stuff, whereas with JavaScript heavy sites, I use a custom wait function, or the waitForSelector with visible: true.

There are no comments on this comment yet.