playwright.expect.expect_to_have_style

playwright.expect.expect_to_have_style(loc, key, value, *, timeout=None)

Expect the style attribute to have a value.

This is different than Playwright's to_have_css(key, value) method, as that method will check for the computed style of the element. Whereas this method will check the style attribute directly.

Parameters

loc: Locator

The Playwright locator to check.

key: str

The CSS key to check.

value: PatternOrStr

The CSS value to check.

timeout: Timeout = None

The maximum time to wait for the style to appear.

See Also