CA
fascinating-indigo
Puppeteer click() angular page
Hey guys, I'm having a weird problem. I have to click the X button on the website and it is normally visible in the HTML code (ul > li > a) and even when I enter the JS code $("#name123").click() in the browser console, it clicks nicely, but not through puppeteer I want to click on it because I can't see it. Here the content is dynamically loaded for sure, but I waited 10 seconds (or even longer) and puppeteer still didn't see it. I also tried with the waitForSelector function, but in the end I got an error that it timed out. Do you know why this is happening?
2 Replies
generous-apricot•3y ago
Try making screenshots and saving it to Key-Value store for debugging. Same with page HTML. There's a chance that it loads for you locally, but in the scraper there's e.g. cookies banner or something else appearing that prevents the needed selector from loading...
other-emerald•3y ago
Do you make that clicking inside an evaluate function? If so, it won't trigger clicking event since the event is loaded on virtual DOM of Angular and clicking must be triggered with puppeteer click function.