playwright.expect.expect_not_to_have_class

playwright.expect.expect_not_to_have_class(loc, class_, *, timeout=None)

Expect a CSS class value is not found.

This method wraps Playwright's Locator expectation not_to_have_class() method. However, Playwright does not have an easy method to check for individual class values within the elements class value.

This method will insert the class string value into a regex pattern to check for the class value within the class attribute according to word boundaries or the start/end of the class string.

Parameters

loc: Locator

The Playwright locator to check.

class_: str

The class value that should not be found within the resolved locator.

timeout: Timeout = None

The maximum time to wait for the class to disappear.

See Also