I am using Ranorex V3.1 for our automated testing. We do not use the Ranorex Studio nor the Recorder. I just use Ranorex Api methods and address the Control via the Ranorex Path.
Everything works fine, but sometimes Ranorex does not hit the Control correct or the PressKeys method looses single keys.
I experienced theese Problems in 2 different situations:
1. Ranorex looses input keys
Code: Select all
Ranorex.Text textBox = ...... //Find TextBox
if (textBox.Enabled)
{
//Select old value
textBox.Select(0, textBox.TextValue.Length);
//Delete old value
textBox.PressKeys("{Delete down}{Delete up}");
//Input new value
textBox.PressKeys("my new Value");
//Leave TextBox for Validation
textBox.PressKeys("{Tab}");
//Make sure, that the right value was set
if (textBox.TextValue != "my new Value")
{
//What went wrong?
}
}
So I tried to do it different via clipboard an pasting, but even then the PressKeys method misses the past command sometimes.
Code: Select all
Ranorex.Text textBox = ...... //Find TextBox
if (textBox.Enabled)
{
//Select old value
textBox.Select(0, textBox.TextValue.Length);
//Input new value
Clipboard.SetText(p_Text);
textBox.PressKeys("{Control down}{vKey}{Control up}");
//Leave TextBox for Validation
textBox.PressKeys("{Tab}");
//Make sure, that the right value was set
if (textBox.TextValue != "my new Value")
{
//What went wrong?
}
}
2. When clicking on a menu item, the cursor moves to upper left corner of the screen
Code: Select all
Ranorex.MenuItem mainMenu = ...... //Find Menu
if (mainMenu.Enabled)
{
mainMenu.Click();
Ranorex.MenuItem subMenu;
//Try to find the submenu
if (!mainMenu.TryFindSingle(@"./contextmenu/menuitem[@accessiblekeyboardshortcut='n']", 500, out subMenu))
{
//What went wrong?
}
//Continue
}
So I hope you can help me. Are problems like this already known?
I have to say, that I run a lot of tests for several hours, so I changed the default times:
Code: Select all
Ranorex.Mouse.DefaultMoveTime = new Ranorex.Duration(10);
Ranorex.Mouse.DefaultClickTime = new Ranorex.Duration(10);
Thanks for your help.
Greets Ralf