Skip to content

[Feature] - Delete a certain cookie instead of clear all cookies #742

Closed

Description

Based on the docs here https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browsercontext we cannot delete a certain cookie, is there any consideration to have that kind of feature?

Activity

  1. pavelfeldman commented on Jan 29, 2020

    @pavelfeldman
    Member

    We could add that. The cookie would be identified by the secure+domain+path+name key. Could you share the use case for the individual cookie removal?

    (You can work around it today via getting all cookies, deleting all cookies and restoring everything but one cookie in case your context is not huge)

  2. kobenguyent commented on Jan 30, 2020

    @kobenguyent
    ContributorAuthor

    Pavel Feldman (@pavelfeldman) I'm not really sure if there are many users want to manipulate the cookies but it would be nice to have an option to delete a special cookie key. Thanks!

  3. PavelBansky commented on Jan 30, 2020

    @PavelBansky

    peterngtr : wrong Pavel

  4. kobenguyent commented on Jan 31, 2020

    @kobenguyent
    ContributorAuthor

    peterngtr : wrong Pavel

    hey man, sorry for the wrong mentioned.

  5. changed the title [-][Question] - Delete a certain cookie instead of clear all cookies[/-] [+][Feature] - Delete a certain cookie instead of clear all cookies[/+] on Feb 27, 2020
  6. zakuru commented on Apr 6, 2020

    @zakuru

    Hi All, peterngtr

    I was thinking about this feature - should not we try do to something like delete all cookies matching a certain set of criteria.
    What would be the point of limiting the scope to delete only one cookie ?
    Would be something like

    cookies.DeleteWhere((cookie) => cookie.domain = "xxx")
    cookies.DeleteWhere((cookie) => cookie.domain = "xxx" && cookie.path == "zzz" )
    
  7. nrayburn-tech commented on Apr 24, 2020

    @nrayburn-tech

    Pavel Feldman (@pavelfeldman), I was looking into adding this. I am not super familiar with how playwright interfaces with Chromium, so correct me if I am wrong anywhere.
    Using docs from here, https://chromedevtools.github.io/devtools-protocol/tot/Storage/, there doesn't seem to be a method for Storage to delete an individual cookie. Page and Network have relevant methods to delete an individual cookie. I don't know if those are applicable though.
    The other option would be like you mentioned, delete all cookies and restore the others. This could be created and exposed to the users as a method just for convenience and would internally still use clearCookies and add/setCookies.
    Any thoughts?

  8. pavelfeldman commented on Nov 19, 2020

    @pavelfeldman
    Member

    The other option would be like you mentioned, delete all cookies and restore the others. This could be created and exposed to the users as a method just for convenience and would internally still use clearCookies and add/setCookies.

    That would probably work.

  9. pavelfeldman commented on Mar 2, 2021

    @pavelfeldman
    Member

    First of all, thank you for filing this issue. We appreciate your input, in many ways Playwright is based on it. This particular feature request didn't get enough stars for us to prioritize the work on it and hence is being closed. We are a relatively small team and we need to prioritize aggressively to deliver support and new features to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions