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.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
Add session.setPuppeteerCookies test
Ondra Urban6e7a953f121a
diff --git a/test/session_pool/session.test.js b/test/session_pool/session.test.jsindex 052fd503c..ca3c3a5a5 100644--- a/test/session_pool/session.test.js+++ b/test/session_pool/session.test.js@@ -165,6 +165,18 @@ describe('Session - testing session behaviour ', () => {expect(session.retireOnBlockedStatusCodes(400, customStatusCodes)).toBeFalsy();});+ test('setPuppeteerCookies should work', () => {+ const url = 'https://example.com';+ const cookies = [+ { name: 'cookie1', value: 'my-cookie' },+ { name: 'cookie2', value: 'your-cookie' },+ ];++ session = new Session({ sessionPool });+ session.setPuppeteerCookies(cookies, url);+ expect(session.getCookieString(url)).toBe('cookie1=my-cookie; cookie2=your-cookie');+ });+describe('.putResponse & .getCookieString', () => {test('should set and update cookies from "set-cookie" header', () => {const headers = {};