Then the "item" element should not contain "CSS style" - Cloned

Asserts that an element does not have a specific CSS property with a given value. The first parameter identifies the element by id, class, name, label, tag, or CSS selector; the second is a CSS declaration written as property: value (a trailing semicolon is allowed and ignored). The step waits up to 10 seconds for the element to appear, then checks the element's computed style and fails if the property matches the given value.

Color values are normalized before comparison, so asserting color:white; also fails if the computed color is #fff or rgb(255, 255, 255). Because computed styles are used, values applied by stylesheets count too, not only inline styles. Use the positive form of this step to assert a style is present.

Accepted phrasings

Then the "element" element should not contain "property: value;"
Then "element" element should not contain "property: value;"

Examples

Then the "body" element should not contain "color:white;"
Then the "Username" element should not contain "padding: 12px 20px;"
Then the "#uname" element should not contain "border:solid 5px red;"
Then the "pword" element should not contain "font-size: 26px;"

In a real scenario

Feature: Form fields have no error styling by default

  Scenario: A clean login form shows no validation highlights
    When I go to "https://example.org/login"
     And wait 2s
    Then I should see "Sign in"
     And the "#uname" element should not contain "border:solid 5px red;"
     And the "pword" element should not contain "font-size: 26px;"
     And the "Username" element should not contain "padding: 12px 20px;"

Related steps

Back to Assertion Steps