Skip to content

UI.doesNotHaveClass()

Asserts that an element does not have the specified CSS class.

If the element has the class, the assertion fails and the test will fail.

Usage

js
UI.doesNotHaveClass(element: string, className: string)

Parameters

ParameterTypeDescription
elementstringElement to target — by CSS or XPath selector.
classNamestringCSS class name that must not be present (without the leading .)

Example

js
I.click("Next")
UI.doesNotHaveClass("#checkout-form", "has-error")

In this example, the test asserts that the #checkout-form element does not have the has-error CSS class.