Skip to content

How do I validate the color of the element

This example demonstrates validating the text color of an element.

In the solution shown below, you will see that the text color in the header section is validated using "assertColor" command in HICC. If the command fails, the entire execution will stop.

Solution:

# Command Target Value
Validating the header text color 
1 assertColor xpath=(//div[@id='pageheadersection']/h1)[1] #2A5FA9

Tips, Tricks, Gotchas & Best Practices:  

  • As an alternative to above, you are encouraged to use commands as given below based on the requirement:

            1. verifyColor -  If the text color does not match with the color specified in the value field due to some application issue, the "assertColor" command fails then it will stop the execution. If you do not want to stop the execution of the other instructions you can use this command for verifying the color of the element text.

            2. waitForColor - When there is a page loading in the application before the visibility of the text whose color is to be verified in the User Interface(UI), you can use this command to wait for the text to load in the UI and then verify the text color.

Feedback and Knowledge Base