Forum Discussion

VStepI's avatar
VStepI
Occasional Contributor
21 days ago

TestComplete has incorrect screen coordinates for objects on second monitor

When our application runs on the default monitor, and locating an object using the ObjectBrowser, it shows the object and it properties, and "Highlight on screen" indeed highlights the object with a red border. But when when our application is moved to the 2nd monitor and doing the same, it cannot find the object.

Even not when refreshing the tree. The Help shows 4 reasons and all are not applicable. The object is visible and nothing is blocking it.

Further analysing: when on the default monitor, the screen coordinates for the window are:

ScreenLeft=2403, ScreenTop=510

and for the object:

ScreenLeft=2432, ScreenTop=518

when on the 2nd monitor, window:

ScreenLeft=604, ScreenTop=510

and for the object:

ScreenLeft=512, ScreenTop=416

I expect 633 and 518 for the screen coordinates of the object inside the window, when on the second screen.

So why is the screen position for an object inside a window incorrect?

 

 

 

8 Replies

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Are you using the same display resolution and scale i.e. 100% on both monitors?

     

    • VStepI's avatar
      VStepI
      Occasional Contributor

      No both monitors have different resolution and different scale. This is a requirement and cannot be changed

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        Hi VStepI​, unfortunately TestComplete doesn't support any other scaling, accept for 100%. This issue has been raised a number of times in previous version of TestComplete, but has never made it, into the top feature request.

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    Technical Checklist for Cross-Monitor Object Coordinates in TestComplete:

    When TestComplete reports incorrect screen coordinates on a secondary monitor, it’s usually related to DPI scaling or monitor layout. To address this, consider:

    1. DPI / Display Scaling: Ensure both monitors use the same scaling (e.g., 100%). Mixed DPI often causes coordinate misalignment.
    2. Monitor Arrangement: Check Windows’ display setup. Unusual arrangements (secondary monitor left/above primary) can offset virtual desktop coordinates.
    3. TestComplete Startup Timing: Start TestComplete after monitors are configured, so it captures correct virtual desktop coordinates.
    4. Privilege Level: Ensure TestComplete runs with the same permissions as the application under test.
    5. Relative Coordinates Option: For multi-monitor setups, using coordinates relative to the parent window can avoid absolute screen-coordinate errors.

    Following this checklist usually resolves issues where objects are detected correctly on the primary monitor but misaligned or unrecognized on secondary monitors.

    🤖 AI-assisted response
    👍 Found it helpful? Click Like
    ✅ Issue resolved? Click Mark as Solution

  • VStepI's avatar
    VStepI
    Occasional Contributor

    Where is the Relative Coordinates Option?

    • Hassan_Ballan's avatar
      Hassan_Ballan
      Icon for Champion Level 3 rankChampion Level 3

      There isn’t a global “Relative Coordinates” option in TestComplete. The tool doesn’t have a single setting that switches everything from screen-relative to window-relative. In normal UI automation you don’t usually specify coordinates at all—TestComplete clicks in the center of the object after calculating its position. So the coordinates you listed are likely diagnostic values, not something you’re intended to use directly.

      The actual issue is that your primary and secondary monitors use different DPI scaling levels. TestComplete is not fully per-monitor DPI-aware, so when the AUT moves to a monitor with different scaling, the screen coordinates it computes for objects can become incorrect. SmartBear explicitly documents this limitation here: Testing With Various DPI Settings

      Regarding “relative coordinates”: the only area where TestComplete exposes this is in low-level procedures, where you can choose to record events using window-relative rather than screen-relative coordinates. These features are documented here: Window- and Screen-Relative Low-Level Procedures and Creating and Recording Low-Level Procedures

      This is not a global option, and it only applies if you explicitly use low-level event recording — most automated tests never need it.

      To improve stability in mixed-DPI environments:

      • Align monitors to the same top edge in Windows Display Settings to minimize virtual desktop coordinate offsets.
      • Prefer object-based actions like Button.Click(), which always use object-relative coordinates.
      • Avoid screen-coordinate clicks.
      • If using low-level procedures, record them in window-coordinate mode and execute them against the specific window.

       

      🤖 AI-assisted response
      👍 Found it helpful? Click Like
      ✅ Issue resolved? Click Mark as Solution

  • VStepI's avatar
    VStepI
    Occasional Contributor

    If this was years and years ago then okay, but 2025 and not handling monitors with different resolution and/or different scaling is outdated! Smartbear should have it on their priority list!

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      TestComplete is a tool for automating tests of desktop, web, and mobile applications. It identifies and interacts with user interface elements to simulate clicks, typing, and other actions. It relies on coordinates and object dimensions to run tests correctly. Windows scaling other than 100% changes how elements are displayed and shifts coordinates, and TestComplete only works reliably at 100% DPI scaling.

      You can create a feature request, and based on the number of up-votes, they will implement it.