Forum Discussion

Bingo's avatar
Bingo
Contributor
5 years ago

There was an attempt to perform an action at point (1439, -108), which is out of the window bounds.

My code:

Aliases.Inventor.refresh
Call Aliases.Inventor.MainWindow.MDIClient.Click(Aliases.Inventor.ViewClientArea2.width-25,12)

I want to use a relative coordinate to click a button that can't be spied by testcomplete. But the test failed in another PC.

Addtional info:
The window size is (1464, 842); screen rectangle: the left top corner is (216, 144), the right bottom corner is (1680, 986).
The screen coordinates of the point is (1655, 36).
 
So I don't know how the testcomplete calculate the coordinate?
  • Thanks, the issue can't appear now. If it still be there, I'm glad to have a try.

  • Pyzdra's avatar
    Pyzdra
    Senior Member

    Have You tried:

    Call Aliases.Inventor.MainWindow.MDIClient.Click(Aliases.Inventor.ViewClientArea2.left+Aliases.Inventor.ViewClientArea2.width-25,12)

    ?

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      any updates to share Bingo ?

      I see that Pyzdra offered another solution to try if this is still an issue for you:smileyhappy:

      • Bingo's avatar
        Bingo
        Contributor

        For virtus detected in China, I'm sorry I'm late to reply you. Thanks all, I found this issue can't appear in our test cases. 

    • Bingo's avatar
      Bingo
      Contributor

      Thanks, the issue can't appear now. If it still be there, I'm glad to have a try.

      • sonya_m's avatar
        sonya_m
        SmartBear Alumni (Retired)

        Glad to here the issue is gone! :smileyhappy:

        I hope the virus will go away soon. Jiayou!

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    > how the testcomplete calculate the coordinate?

    .Left and .Top object's properties are relative to the parent container's one.

    .ScreenLeft and .ScreenTop are relative to the desktop.

    Does this help?

     

    • Bingo's avatar
      Bingo
      Contributor

      Thanks AlexKaras , I know these one. As you see, the click action don't execute the coordinate what I expressed, so it failed. It is a confuse question for some testers.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        So... Is the problem solved or not?

         

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Am-m-m... Still not sure that I got your answer...

     

    > I will record it here.

    If it is just for the record, then OK.

    If you are looking for the solution, then this is simple - put a breakpoint on the problematic line with a call to .Click() (or add debug logging right before it if you don't have TestComplete installed on the box where the problem occurs), analyse the values of all participating objects (MDIClient, ViewClientArea2), calculate click coordinates manually and verify that TestComplete clicks at correct point, consider where the click must be done and consider what coordinates of what objects must be used to obtain the required values.

    Hope, this will help.

     

    P.S.

    > Aliases.Inventor.refresh

    Considering that you are using Aliases (which is right) and if some aliased object is recreated while it is used by test code, I would recommend to consider .RefreshMappingInfo() method. (See documentation for the description of the difference between .Refresh() and .RefreshMappingInfo())