Skip to content

[Bug]: getByRole does not accept RegExp v flag in the name option #41457

Description

@TaishiKobari

Version

1.61.0

Steps to reproduce

Repro repo: https://github.com/TaishiKobari/playwright-issue-regex-v-flag

  1. Clone the repro repo
  2. Run pnpm install
  3. Run pnpm test

The repro contains two tests against https://playwright.dev/:

  • page.getByRole("link", { name: /Get started/v })
  • page.getByRole("link", { name: /Get started/ })

The second test passes, but the first one fails.

Expected behavior

Both tests should pass.

Actual behavior

Only the test without the v flag passes.

Additional context

No response

Environment

System:
  OS: macOS 26.5
  CPU: (11) arm64 Apple M3 Pro
  Memory: 2.59 GB / 36.00 GB
Binaries:
  Node: 24.16.0 - ~/.local/share/mise/installs/node/24.16.0/bin/node
  npm: 11.13.0 - ~/.local/share/mise/installs/node/24.16.0/bin/npm
  pnpm: 10.7.0 - /opt/homebrew/bin/pnpm
IDEs:
  VSCode: 1.125.1 - /opt/homebrew/bin/code
  Claude Code: 2.0.30 - /opt/homebrew/bin/claude
  Codex: 0.142.0 - /opt/homebrew/bin/codex
Languages:
  Bash: 3.2.57 - /bin/bash
npmPackages:
  @playwright/test: 1.61.0 => 1.61.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions