MarketSquare / MarketSquare/robotframework-browser

Add cookie filters and partitioned-cookie support: `Delete All Cookies` filters, `Get Cookies urls=`, `Add Cookie partitionKey=`

Open
#5,106 0 comments 0 reactions 1 assignee View on GitHub

@Snooz82 is already working on this.

Since Aug 6, 2026.

enhancement
Dominant language
Python
Stars
655
Forks
147
Avg merge
5h 27m
Merged PRs (30d)
59

Description

Use case

Three small parity gaps in the cookie keywords, bundled because they touch the same module:

  1. Selective cookie deletion. Deleting just the session cookie while keeping consent/preference cookies is a common pattern (e.g. force a re-login without re-triggering the cookie banner). Today Delete All Cookies is all-or-nothing, so users must Get Cookies, delete everything, and painstakingly re-add the cookies they wanted to keep.

  2. URL-filtered cookie retrieval. Get Cookies always returns every cookie in the context. Filtering to the cookies that would actually be sent to a given URL can be approximated in Robot code, but the native filter also applies path/secure/domain matching rules correctly, which hand-rolled filtering usually gets wrong.

  3. Partitioned (CHIPS) cookies. As browsers phase out unpartitioned third-party cookies, apps increasingly set cookies with a partition key. There is currently no way to create such a cookie with Add Cookie, and Get Cookies does not show the partition key, so partitioned-cookie behavior cannot be tested at all.

Proposed keyword / arguments

All new arguments are named-only with None defaults (current behavior unchanged when omitted):

  • Delete All Cookies *, name=None domain=None path=None — when any filter is given, only matching cookies are removed.
  • Get Cookies return_type=dict *, urls=Noneurls is a single URL or a list of URLs.
  • Add Cookie name value url=None domain=None path=None expires=None httpOnly=None secure=None sameSite=None *, partitionKey=None
  • Get Cookies output dicts additionally carry a partitionKey key when present.
*** Test Cases ***
Force Relogin Keeping Consent
    Delete All Cookies    name=session_id
    Reload
    Get Text    h1    ==    Please log in

Assert Cookies Sent To API Host
    ${cookies}=    Get Cookies    urls=https://api.example.com/v1
    Length Should Be    ${cookies}    2

Test Partitioned Third Party Cookie
    Add Cookie    tracker    abc123    url=https://third-party.example
    ...    partitionKey=https://site.example
    ${cookies}=    Get Cookies
    Should Be Equal    ${cookies}[0][partitionKey]    https://site.example

Playwright API

Implementation notes

  • protobuf/playwright.proto: extend the cookie RPC request messages with the filter fields, urls list, and partitionKey.
  • node/playwright-wrapper cookie handlers: pass the options through to clearCookies/cookies/addCookies; include partitionKey in serialized cookie output.
  • Browser/keywords/cookie.py: new named-only arguments on the three keywords; docs for each.
  • atest: filtered-delete test, urls-filter test; partitionKey round-trip (Chromium supports CHIPS).

Backwards compatibility

Purely additive: all new arguments are named-only and default to None (no filtering / no partition key), and the partitionKey output field is an additive dict key. Existing suites see identical behavior and data.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.