Skip to main content

Use getCssValue in Scenario Editor Scripts

Use getCssValue in Scenario Editor Scripts

IsUse usedgetCssValue toonly retrievewhen validating a CSS property is part of the csstest propertyobjective. valueFor most functional tests, validate visible behavior or business output instead of animplementation-level elementstyles.

Example:

In

  • Confirm a required state is represented by a CSS property, such as disabled, highlighted, hidden, or color-coded status.
  • Validate style behavior only after the abovepage example,has reached a stable state.
  • Keep expected values maintainable and avoid checking browser-specific formatting unless necessary.

Maintenance notes

  1. Prefer stable locators for the Linkelement Macbeing element,inspected.
  2. Use conditional waits before reading style values.
  3. Document why the colorCSS property shall be retrieved. This is usually stored in a variable to be used in further scripting.business-relevant.

image-20220322-214717.png

Javascript example

navigateTo("http://myplaceforparts.com/web/alliance/home  ");click(heading1("site-title"));        click(bold("Home"));        var $headerColor=getCssValue(heading1("site-title"),"color");        assertEqual($headerColor,"rgb(0, 0, 0)");        var $homeFontWeight=getCssValue(bold("Home"),"text-align");        assertEqual($homeFontWeight,"left");

Last updated: JuneSeptember 26,18, 20232026

If you have any feedback on this topic, please contact us at documentation@appvance.ai