scrapy-plugins / scrapy-playwright

🎭 Playwright integration for Scrapy
BSD 3-Clause "New" or "Revised" License
992 stars 108 forks source link

This is not an issue, rather it is a question regarding cookies #270

Closed kmuente closed 5 months ago

kmuente commented 5 months ago

With this framework how do I define a cookie in a yield request? I ask because I don't see in the documentation how to do it. Hoping not to disturb, I look forward to prompt responses. Kind regards, Karlo Muente.

elacuesta commented 5 months ago

There are no specific docs about setting cookies because it's not different from regular Scrapy, just use the cookies Request parameter. Also, any way that you can set cookies for a Page or a Context in Playwright (for instance Page.set_extra_http_headers) also works here if you request the retrieval of the page object.

See some relevant notes about headers in general at https://github.com/scrapy-plugins/scrapy-playwright?tab=readme-ov-file#playwright_process_request_headers