Well I have accomplished a lot so far with automating the GUI testing at my work... I'm happy with Ranorex and I plan on writing a proposal for a license..
Anyways I have a question regarding pushbutton. So far I have tried to write the code myself with no success then I tried to use RanorexRecorder to record the process of selecting okay from a child dialog box that apprears.
// Find child element by Role=PushButton Name=OK ClassName=Button
element = formElement.FindChild(Role.PushButton, "OK", "Button");
Mouse.ClickControl(control, MouseButtonType.LeftButton, new Point(47, 12), 1, 953);
What happens is the cursur goes right past the dialog box and I get an error message.
It throws a commandfailed exception.
pushButton
Did you use the dialog element in the FindChild(Role.PushButton) function?
The following code works with the sample VS2005Application.exe:
It opens the FileOpen dialog, finds the dialog, sets the file name and clicks the Open PushButton.
Please try it and post a replay if it doesn't work.
Jenö
Ranorex Team
The following code works with the sample VS2005Application.exe:
It opens the FileOpen dialog, finds the dialog, sets the file name and clicks the Open PushButton.
Code: Select all
ret = menuStrip.SelectItemText("Submenu3", "FileOpen");
Form openFileDialog = Application.FindFormTitle("Open",SearchMatchMode.MatchExact,true,1000);
if (openFileDialog == null)
{
Console.WriteLine("ERROR: OpenFileDialog not found ");
return 1;
}
Element fileEditControl = openFileDialog.Element.FindChild(Role.Text,"File name:");
if( fileEditControl != null)
fileEditControl.Value = "D:\\Ranorex-1.2.0\\Bin\\RanorexSpy.exe";
Element openButton = openFileDialog.Element.FindChild(Role.PushButton,"Open","Button");
if (openButton != null )
Mouse.ClickElement(openButton);
Jenö
Ranorex Team