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.
Solved! Go to Solution.
Thanks, the issue can't appear now. If it still be there, I'm glad to have a try.
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?
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.
Hi,
So... Is the problem solved or not?
No, thanks, I will record it here. Maybe someone will suffer same stable question.
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())
Thanks,
It's a problem that I want to solve it.
But I have tried some times, it's hard to understand, I get a negative coordinate. If I get the answer, I will notice for it.
> Call Aliases.Inventor.MainWindow.MDIClient.Click(Aliases.Inventor.ViewClientArea2.width-25,12)
My wild guess is that the MDIClient object was recreated while test code was using it (for example, the form was closed amd reopened) and thus test code reused it from the cache (see description and code sample in the documentation for the .RefreshMappingInfo() method).
I would try to change the code to this:
Call Log.Message(Aliases.Inventor.MainWindow.MDIClient.Top) ' remove after debug
Call Aliases.Inventor.MainWindow.MDIClient.RefreshMappingInfo()
Call Log.Message(Aliases.Inventor.MainWindow.MDIClient.Top) ' remove after debug
Call Aliases.Inventor.MainWindow.MDIClient.Click(Aliases.Inventor.ViewClientArea2.width-25,12)
and check if it helps.
Yeah, I have guess it so I refresh test object's parent. But the object always the same, I don't operate it. And You support a good way for me to debug. I will have a try, thanks!
> so I refresh test object's parent.
To say the truth, I am not sure if refreshing parent's objects tree refreshes Aliases cache. That is why I recommended to try to .RefreshMappingInfo() for the object itself.
Subject | Author | Latest Post |
---|---|---|