Skip to content

[Question]: Implement expect_selector context manager #1638

Open
@kblok

Description

@kblok

Your question

I was taking a look at this question on Stack Overflow.
The issue there is that the user wants to test the loading action after clicking a button, but by the time it tries to assert, the loading element is gone.
This is their example:

button.click() # this triggers the API fetch
expect(page.locator("[id=loading-banner]")).to_be_visible()

I was wondering whether that might be solved with something like this:

with page.expect_selector("[id=loading-banner]"):
    button.click()

Note: You know I'm not quite proficient in python. I'm just building a bridge to that question :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions