The Form class function GetControls() makes a connection to the automated form, reads all controls and fills the Form property Controls. For speed reasons the function will not called in the constructor of the Form class. The user must call the GetControls() function to read and fill the control array.
Code: click into code to enlarge
form.GetControls();
foreach (Control control in form.Controls)
{
IntPtr handle = control.Handle;
Point location = control.Location;
Size size = control.Size;
String text = control.Text;
Console.WriteLine("Handle={0} Location={1} Text={2}", handle, location, text);
}
See also the sample project RanorexVS2005Sample4
I’m sorry for the poor documentation, we will extend it with some samples in the next version.
> Why the classes in RanorexNet have the same names as in System.Windows.Forms?
Normally you make a console application if you write testscripts, so you don't use the System.Windows.Forms namespace.
It's easier to write and understand the automation code if you use the same class names as in the real application.
Jenö Herget
Ranorex Team |