Forum Discussion

Emerson's avatar
Emerson
Occasional Contributor
5 years ago

Click with screen percentage rather than coordinates?

Hi,

 

I am attempting to implement automation testing for the company. The software we are testing is a "whiteboard" application, basically a smart painting app. We deal with multiple screen sizes/resolutions and the main problem I am worried about is how to make it click/drag based on percentages and not coordinates?

So in this scenario:

Tool bar starts 2% from the left side of the screen and ends after 5%, I want to then start drawing approximately after 10% of the screen width?

 

1 Reply

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Every UI control (window object) of the tested application recognized by TestComplete has .ScreenLeft and .ScreenTop properties that describe control's position relative to the desktop screen. You can use them to calculate required percentage and either use it as it is or to convert to client coordinates via the .ScreenToWindow()/.WindowToScreen() methods.