Skip to content

[Feature] Allow ElementHandle as an input to DOM expect matchers #11145

@Meemaw

Description

@Meemaw

We're using https://github.com/testing-library/playwright-testing-library for selecting elements on our page. Those return ElementHandle, which doesn't seem to be compatible with some expect matchers.

Simple example:

const buyButton = await queries.findByText($document, "Buy")
expect(buyButton).toBeDisabled()

Throws:

Error: toBeDisabled can be only used with Locator object

There might be a way to get a Locator from ElementHandle (not sure), but it would be great if those also worked with ElementHandle itself.

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