Skip to content

[BUG] "Selector resolved to several elements" but the inspector reports only 1 element #11071

@neongreen

Description

@neongreen

Context:

  • Playwright Version: 1.17.1
  • Operating System: macOS
  • Node.js version: 16.13.0
  • Browser: Chromium

I have a selector that looks like this: *_react=ReplyComponent >> :has-text("something"). My understanding is that it would match a <ReplyComponent ...> that has "something" somewhere inside. I have only one <ReplyComponent ...> on the page, and the inspector agrees with me — see the screenshot below. (Sorry for smell engineers, all text is autogenerated!)

However, page.locator fails with a strict mode violation — it thinks the selector resolves to three elements. What am I doing wrong?

image

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