Skip to content

userDataDir in config file is ignored, browser always launches with in-memory profile #1446

@chris-fundamental

Description

@chris-fundamental

Description

userDataDir set in the config file has no effect. The browser always launches with user-data-dir: regardless of the config. The --profile CLI flag works correctly for the same path.

Steps to reproduce

Create .playwright/cli.config.json:

{
  "browser": {
    "browserName": "chromium",
    "userDataDir": "/Users/chris/.my-profile",
    "launchOptions": {
      "headless": false
    },
    "contextOptions": {
      "viewport": {
        "width": 1280,
        "height": 900
      }
    }
  }
}

Run:

npx playwright-cli open https://example.com --config .playwright/cli.config.json

Output shows:

- user-data-dir: <in-memory>

Also tried:
playwright-cli.json, ~/.playwright at project root and I tried changing between userDataDir abs path and relative path at project root - same result.

Expected behavior

Browser should launch with user-data-dir: /Users/chris/.my-profile and persist cookies/state across sessions.

Actual behavior
user-data-dir is always . Login state is lost when the browser closes.

Workaround

Passing --profile directly works:

npx playwright-cli open https://example.com --profile=/Users/chris/.kaggle-playwright-profile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions