Thanks for your answer. Unfortunately I have a strange problem with the
Mouse.ClickElement, for which reason I'd like the
DoDefaultAction(). Well, the problem is the following: I have a loop (can be a sequence too, the problem appears anyway) to create various users:
Code: Select all
for (int i = 0; i < 5; i++)
{
myTreeView = myHelper.FindTreeView("mTreeView");
myTreeView.SelectItem("Everyone");
Ranorex.Application.Sleep(300);
myHelper.clickMenuItem("File/New/User");
myHelper.clickMenuItem("Edit/Rename");
Ranorex.Application.SendKeys("UserGroup" + i + "{ENTER}");
and in the class
myHelper
Code: Select all
public void clickMenuItem(String menuPath)
{
foreach (String menuItem in menuItems)
{
String[] menuItems = menuPath.Split('/');
foreach (String menuItem in menuItems)
{
Ranorex.Element elemMenuItem = mainForm.Element.FindChild(Ranorex.Role.MenuItem, menuItem);
Ranorex.Mouse.ClickElement(elemMenuItem);
}
}
}
The code opens a menu "File>New>User". This works well the first time. The second time the element "User" found by
FindChild() contains the wrong x coordinate, which sends the mouse to the wrong point. The x coordinates seems to be the same as the x coordinate of the main application window (Ranorex.Form).
I don't understand why the first time to object properties are correct and the second time not.
Update
In some cases (e.g. other menu items) the use of the
Ranorex.Mouse.ClickElement() don't work either the first time.
The menu is a MenuStrip.