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

Name Type Description Default
loc Locator The Playwright locator to check. required
class_ str The class value that should not be found within the resolved locator. required
timeout Timeout The maximum time to wait for the class to disappear. None

See Also