playwright.expect.expect_to_have_style
*, timeout=None) playwright.expect.expect_to_have_style(loc, key, value,
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
Name | Type | Description | Default |
---|---|---|---|
loc | Locator |
The Playwright locator to check. | required |
key | str | The CSS key to check. | required |
value | PatternOrStr |
The CSS value to check. | required |
timeout | Timeout |
The maximum time to wait for the style to appear. | None |