How to use waitForSelector in Puppeteer to get all p tags on a page?

18 Replies, 1558 Views

Hey folks,
So I’ve been messing around with Puppeteer lately, and I’m trying to figure out how to use waitforselector puppeteer get all p tags. Like, I want to grab all the `<p>` tags on a page, but only after the page has fully loaded.

I tried just using `page.$$('p')`, but sometimes it misses stuff cuz the page isn’t ready yet. So I’m thinking, maybe I need to use waitforselector puppeteer get all p tags properly? Like, wait for at least one `<p>` to show up first, then grab all of them.

Anyone got a quick example or tips? I’m kinda stuck and don’t wanna overcomplicate it lol.

Thx in advance! ✌️

Messages In This Thread
How to use waitForSelector in Puppeteer to get all p tags on a page? - by - 24-08-2024, 04:40 PM



Users browsing this thread: 1 Guest(s)