python-2.7automationtestcomplete

How can verify the font size and color in Python (web page)?


Can we verify the window/web page, font size and font color using Python?


Solution

  • HTML Text objects should have a 'currentStyle' collection property. That property will consist of every aspect of the text, from font size to color listed as a 'Field'. You can use checkpoints to evaluate that data or just access the data during testing.

    On the Page object there is a 'contentDocument' collection which has all the details of the page from general sizes, fonts, and colors, etc.

    The Page object also has a 'Height' and 'Width' property for that specific page. If you need to get to granular level all the data is at the page level.

    You can investigate these using the object spy and then looking through all the available properties and fields of the objects