Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

chore(e2e): keep 403 responses retryable in the camoufox-cloudflare fixture

Martin Adámek7aea1f5c37af
diff --git a/test/e2e/camoufox-cloudflare/actor/main.js b/test/e2e/camoufox-cloudflare/actor/main.js
index 6c0a1c017..5d72b90f2 100644
--- a/test/e2e/camoufox-cloudflare/actor/main.js
+++ b/test/e2e/camoufox-cloudflare/actor/main.js
@@ -16,6 +16,11 @@ await Actor.main(async () => {
// The target hard-blocks datacenter IP ranges outright (block page, not a solvable
// challenge), so this test needs residential exit nodes.
proxyConfiguration: await Actor.createProxyConfiguration({ groups: ['RESIDENTIAL'] }),
+ // Cloudflare serves its challenge with a 403 status. v3's handleCloudflareChallenge removed
+ // 403 from the session pool's blocked status codes itself; in v4 that is an explicit crawler
+ // option, and keeping 403 in the default set would fail challenged requests before the hook
+ // below gets a chance to solve them on retries.
+ blockedStatusCodes: [401, 429],
browserPool: playwrightBrowserPool({
// Camoufox ships its own anti-detection; Crawlee's fingerprint injection conflicts with it
// and keeps Cloudflare from ever clearing the challenge.