w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
363 stars 40 forks source link

Get cookies of the given url #645

Closed sadym-chromium closed 8 months ago

sadym-chromium commented 8 months ago

Currently, there is no way to get cookies will be provided for the given url, but this API seems reasonable and is required by Puppeteer.

In order to enable this scenario, consider extending storage.getCookies filter with url.

OrKoN commented 8 months ago

I think we can do filtering based on domain/path in Puppeteer. I think it would be better behavior for Puppeteer users.

OrKoN commented 8 months ago

To expand on it, the current behavior might return cookies that are present in storage but the browser decides to exclude them for an URL due to some reason (reason is never reported). Also, I believe it would return expired cookies which kind of undoes the URL check if think of it as a question on whether the browser will choose to include the cookie in a given request.

sadym-chromium commented 8 months ago

The cookie can be sent or not in the specific request depending on the request itself, so it's not feasible to implement this filter in storage domain. If the user wants to make sure if the cookie is sent, they have to check it out in the network.BeforeRequestSent event.