-
Notifications
You must be signed in to change notification settings - Fork 142
Closed
Description
Is it possible to access the playwright cookies in the callback without passing the page itself ? it can be accessed by storing into global variable but that could cause issues in case of multiple pages.
It would be very useful to have the page cookies in the callback.
def start_requests(self) -> Iterable[Request]:
url = "https://corp.sec.state.ma.us/CorpWeb/CorpSearch/CorpSearch.aspx"
yield scrapy.Request(url, callback=self.parse, meta={
"playwright": True,
"playwright_page_methods": [
PageMethod(self.init_session)
]
})
async def init_session(self, page: Page) -> None:
cookies = await page.context.cookies()
return cookies
def parse(self, response: Response):
# how to access playwright cookies here,
pass
Metadata
Metadata
Assignees
Labels
No labels