
Puppeteer Scraper
No credit card required

Puppeteer Scraper
No credit card required
Crawls websites with the headless Chrome and Puppeteer library using a provided server-side Node.js code. This crawler is an alternative to apify/web-scraper that gives you finer control over the process. Supports both recursive crawling and list of URLs. Supports login to website.
Delay or setTimeout() FUNCTION
the scraper is not responding to a setTimeout function.
I want the Apify puppeteer scraper to return some data and then after that it should delay 20 seconds before it clicks a button on the page. How can this be achieved.
Hello and thank you for your interest in this Actor!
Apologies for the delay in responding to your issue.
You can easily achieve this delay using the Promise constructor with setTimeout
trick, as shown below:
1log.info(+Date.now()); 2 3await new Promise(r => setTimeout(r, 5000)); 4 5log.info(+Date.now());
This code runs in the Page function and will log two timestamps that are 5000 milliseconds apart. You can adapt this approach to introduce a 20-second delay before clicking a button. Make sure to update the Actor timeouts appropriately.
I'll go ahead and close this issue, but feel free to open a new one if you need further assistance!
Actor Metrics
446 monthly users
-
96 bookmarks
>99% runs succeeded
33 days response time
Created in Apr 2019
Modified 8 months ago