Tal Angel
Tal Angel

Reputation: 1782

How to expect attribute value with timeout using Playwright

This is my code:

expect(self.page.wait_for_selector(CSS_OF_ELEMENT, timeout=5000))\
    .to_have_attribute('aria-disabled', value)

My goal is to wait for an element with a given timeout, and search for the value of the attribute 'aria-disabled'.

The code doesn't compile. I get this error:

{ValueError}Unsupported type: <class 'playwright.sync_api._generated.ElementHandle'>

How do I fix my code?

Upvotes: 0

Views: 1896

Answers (1)

Alapan Das
Alapan Das

Reputation: 18650

You can do like this:

expect("SELECTOR").to_have_attribute("aria-disabled", "value", timeout=5000)

Upvotes: 1

Related Questions