Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

How to fix my code?

>Solution :

You can do like this:

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading