playwright-python icon indicating copy to clipboard operation
playwright-python copied to clipboard

[Question]: Implement expect_selector context manager

Open kblok opened this issue 3 years ago • 1 comments

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 :)

kblok avatar Nov 09 '22 13:11 kblok

has this issue been resolved yet ? if no can i contribute to it ?

HermanBide avatar Feb 09 '24 19:02 HermanBide