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.

refactor: tweak jsdom settings a bit 3

Martin Adámek643f01b67a2c
diff --git a/packages/jsdom-crawler/src/internals/jsdom-crawler.ts b/packages/jsdom-crawler/src/internals/jsdom-crawler.ts
index f30067d6f..38204b416 100644
--- a/packages/jsdom-crawler/src/internals/jsdom-crawler.ts
+++ b/packages/jsdom-crawler/src/internals/jsdom-crawler.ts
@@ -233,7 +233,7 @@ export class JSDOMCrawler extends HttpCrawler<JSDOMCrawlingContext> {
}),
});
window.document.createRange = () => {
- const range = new Range();
+ const range = new window.Range();
range.getBoundingClientRect = () => ({} as any);
range.getClientRects = () => ({ item: () => null as any, length: 0 }) as any;
return range;