MarketSquare / MarketSquare/robotframework-browser
Add cookie filters and partitioned-cookie support: `Delete All Cookies` filters, `Get Cookies urls=`, `Add Cookie partitionKey=`
@Snooz82 is already working on this.
Since Aug 6, 2026.
- 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:
-
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 Cookiesis all-or-nothing, so users mustGet Cookies, delete everything, and painstakingly re-add the cookies they wanted to keep. -
URL-filtered cookie retrieval.
Get Cookiesalways 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. -
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, andGet Cookiesdoes 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=None—urlsis 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=NoneGet Cookiesoutput dicts additionally carry apartitionKeykey 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
- browserContext.clearCookies —
name/domain/pathfilter options - browserContext.cookies —
urlsparameter andpartitionKeyin returned cookies - browserContext.addCookies —
partitionKeycookie field
Implementation notes
protobuf/playwright.proto: extend the cookie RPC request messages with the filter fields,urlslist, andpartitionKey.node/playwright-wrappercookie handlers: pass the options through toclearCookies/cookies/addCookies; includepartitionKeyin 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.