Forum Discussion

deepl's avatar
deepl
New Contributor
7 years ago

Alignment of Web Elements in Test Complete

How do we validate the alignment of web elements(Whether they are right aligned or left aligned or center) on a web page in test complete? I am doing a keyword test.

2 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    All web page elements identified by TestComplete have .Left, .Width, .ScreenLeft, .Top, .Height and .ScreenTop properties that you can use to figure-out exact element's size and location on the screen / within web page.

    However, the above approach seems to be reasonable mostly in the case when you have strict requirements like 'elements a, b, and c *must* be right-aligned with the right border located at xx pixels from the page's right edge'.

    In most cases, especially for different browsers, the exact location of web element on the page may deviate for a pixel or two. This deviation depends on the tool / technology that was used to generate the page and browser's rendering engine and usually can be ignored because it is not noticed by the human eye.

    In this case you may consider some visual testing tool / technology that performs an intellectual analysis of web page (or desktop form) and reports the result depending on whether or not the page looks the same from the end-user point of view. www.applitools.com is an example of such tool / technology that can be quite easily integrated with TestComplete tests (via their Images SDK).