Skip to content

[🐛 Bug]: browser.getCookies() returns empty array in BiDi mode #15033

@karasolga

Description

@karasolga

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.23.0

Node.js Version

=20.12.0

Mode

Standalone Mode

Which capabilities are you using?

{
   "browserName": "chrome",
   "goog:chromeOptions": {
      "args": ["--disable-extensions", "--disable-gpu", "--disable-dev-shm-usage", "--no-sandbox", "--guest"]
    },
    "wdio:enforceWebDriverClassic": false 
}

What happened?

When wdio:enforceWebDriverClassic is set to false (BiDi mode), browser.getCookies() fails to retrieve any cookies, returning an empty array. Switching to Classic mode (true) works as expected and returns all cookies.

What is your expected behavior?

browser.getCookies() should return all cookies for the current domain regardless of the underlying protocol.

How to reproduce the bug.

git clone https://github.com/karasolga/wdio-cookie-test.git
cd wdio-cookie-test
yarn install
yarn test

it will return [] of cookies, to check that it works in the classic mode Open wdio.conf.ts and change 'wdio:enforceWebDriverClassic': false to true.

Relevant log output

[0-0] 2026-01-19T12:49:19.616Z INFO webdriver: BIDI COMMAND storage.getCookies {}
[0-0] 2026-01-19T12:49:20.664Z INFO webdriver: BIDI RESULT {"id":11,"result":{"cookies":[],"partitionKey":{"userContext":"default"}},"type":"success"}
[0-0] Webdriver sees Secure Cookie: 
[0-0] Error in "tests cookies.should successfully retrieve all session cookies after page load"
Error: expect(received).not.toHaveLength(expected)

Expected length: not 0
Received array:      []

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions