Strange behavior of DoDefaultAction() and Mouse.ClickElemen

Class library usage, coding and language questions.
Posts: 14
Joined: Tue Mar 04, 2008 1:36 pm

Strange behavior of DoDefaultAction() and Mouse.ClickElemen

Post by lasombra » Tue Mar 18, 2008 3:56 pm

As mentioned in my post ... -t354.html I have a strange behavior, that an element found, has the wrong coordinates, such that Mouse.ClickElement() does not work.
Well I have a loop, that is looking for an element and press a menu button. If the button is pressed by Mouse.ClickElement() the first time, this works well. But the following times the element has the wrong coordinates and thus the mouse cursor goes to the wrong position.

For the same test case I try to use the

Code: Select all

DoDefaultAction(). The behavior of this is similar: The first time all works well, the following times the DoDefaultAction() does nothing.

While debugging I see, that the correct element is found and the default action is "press". So why it does not what I expect?

My Version of Ranorex: 1.2

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue Mar 18, 2008 4:56 pm

Could you please post the code snippet the problem occurs in? In particular the loop and the search code! How many items are accessed within the loop?

This might be a problem of the element caching algorithm (see topic Problems automating Infragistics DataGrid control) which is fixed with the upcoming 1.4 Ranorex release, but I'm not sure of that.

If you are trying to click menu items, the best way is to use the Menu or MenuStrip class which both provide a SelectItemText method.

Ranorex Support Team