Why doesn't puppeteer wait for page to load?

rushjurassicparkfly

Well-Known Member
OP
Newcomer
Joined
Oct 7, 2022
Messages
72
Trophies
0
Age
31
Location
Jersey City
XP
189
Country
United States
Particularly struggling with waituntil: load. And not just parts, some sites have most of the page not loaded (most of them SPAs dependent on the browser for js, but not only this type). So when I take a screenshot and half the page is blank. The page load event fires too early for these sites and I need a way around this. The same issue happens with waituntil: domcontentloaded, but ok, I didn't really count on this one. I need accurate screenshots for the company's archive and since I started with this very recently, I don't really want to show I'm struggling (not the best working environment, as you can guess). The colleague who was previously working on this only started the process, there isn't much in his docs.
 

amusingmuse22

Active Member
Newcomer
Joined
Jun 7, 2023
Messages
31
Trophies
0
Age
26
XP
87
Country
Belgium
The page.waitfornetworkIdle() method lets you specify the number of milliseconds to wait for the network to be idle and this can help when dealing with SPAs. The method I mentioned fixed the problem for me, but I don't take that many screenshots, so I can't tell you it'll be a fix for all sites. Here's my source, you'll find this and a couple of other methods described in more detail. A friend of mine is a web designer, and he told me about this blog. He actually uses the tool itself, I don't know if this is an option for you. (I personally haven't tried it.). Either way, you can test a few options described there and see how it goes. And sorry to hear about the work situation. I've been there (most of us have, I imagine); not having supportive coworkers made me quit my previous job (there were other factors involved, but this one played a big role).
 
Last edited by amusingmuse22,
  • Like
Reactions: rushjurassicparkfly

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv3 @ K3Nv3: https://www.torquenews.com/11826/cybertruck-buyer-says-tesla-trying-sell-him-cybertruck-has-been-...