We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e86b5ea commit dc0502eCopy full SHA for dc0502e
index.js
@@ -38,9 +38,12 @@ const initializeCrawler = async () => {
38
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
39
},
40
requestHandler: async ({ request, page }) => {
41
- await page.waitForNavigation({ waitUntil: "load" });
42
-
43
- await sleep(2000);
+ await Promise.race([
+ page.waitForNetworkIdle({ idleTime: 500, concurrency: 3 }),
+ new Promise((_, reject) =>
44
+ setTimeout(() => reject(new Error("Timeout")), 10000),
45
+ ),
46
+ ]);
47
48
await page.evaluate(() => {
49
return window.scrollBy(0, window.innerHeight);
0 commit comments