English|Deutsch
Subscribe Ranorex Announcements Feed Ranorex LinkedIn Ranorex twitter Ranorex Facebook Ranorex Google+

CheckedListBox

This Documentation is only for Ranorex 1.x versions.

Click here for the Ranorex test automation documentation

Find and check an element of a CheckedListBox

Use RanorexSpy to get the properties of the element and of its parent window. Drag the finder tool over the selected element and release the mouse button.
Find the Control with the Form.FindControlName function.
Control checkedListBox = form.FindControlName("checkedListBox1");
if ( checkedListBox == null )
{
      Console.WriteLine("ERROR: checkedListBox not found ");
      return -1;
}
Read the properties with the Element functions.
Element rootElement = checkedListBox.Element;
Element element = rootElement.FindChild(Role.CheckButton,"Item2");
if( element != null )
{
      Point point = element.Location;
      Size size = element.Size;
 
      element.Select(Selection.TakeFocus|Selection.TakeSelection);
      Console.WriteLine("  Item Value={0} Location=({1},{2})
           DefaultAction={3}", element.Value, point.X, point.Y,
            Element.DefaultAction);
 
     
      element.DoDefaultAction();
      Console.WriteLine("  Item Value={0} Location=({1},{2})
            DefaultAction={3}", element.Value, point.X,
              point.Y, element.DefaultAction);           
 
}