web » assertCssNotPresent(locator,property)
Description
This command asserts the absence of a specific CSS property for a given web element denoted via locator
.
Any of the following will result in a FAIL for the corresponding step:
- If the specified web element cannot be found via the
locator
, - If the specified CSS
property
is found for the specified web element, - If an non-empty
value
is found for the specified CSSproperty
.
Note that there are a few caveats to consider in terms of CSS property.
- If the CSS property in question is a color property (such as
background-color
orcolor
), then it’s a good idea to specify it in the RGBA form. For example, instead of specifyinggreen
, specifyrgba(0, 255, 0, 1)
clarifies both the mix of red, green and blue value, as well as the alpha (transparent) value. Here are some online tools to help with the color conversion: - Shorthand CSS properties (e.g.
background
,font
,border
,border-top
,margin
,margin-top
,padding
,padding-top
,list-style
,outline
,pause
,cue
), while are supported, might result in cross-browser incompatibility. The support for some of these CSS shorthands are not uniform across browser and some of them are still under review. Use the CSS longhand, likebackground-color
, instead ofbackground
. To determine the longhand CSS properties, check out this article: - Nexial currently does not support automatic unit conversion, such as “px” to “em”, or “pt” to “in”. One must use extra care when dealing with CSS properties that use measurement units.
Parameters
- locator - this parameter is the locator of the element.
- property - this parameter is the css property which is not expected in that element.
Example
Script:
Output: