Difference between Control and Element

Ask general questions here.
kollavenkat
Posts: 1
Joined: Sun Jan 20, 2008 4:09 pm
Location: Hyderabad
Contact:

Difference between Control and Element

Post by kollavenkat » Sun Jan 20, 2008 4:26 pm

Hi,

I am new to Ranorex. Can anybody please explain me the diffrence between Control and Element? Are they same representing diffrent set of attributes? Why Ranorex need both? Please explain me some basic things about these two.

Thanks & Regards,
Srinivas Kolla.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Post by Support Team » Mon Jan 21, 2008 10:50 am

The short answer:
Every control is made up of a number of smaller elements. Elements are the atoms and controls the molecules of a graphical user interface.

The longer answer:
Controls are the primary Windows GUI objects each identified at runtime by a window handle. Every type of control enables some other kind of user interaction at a different level of complexity, e.g. a label just shows some information whereas the more complex ListView may also be used to select an item or display its items in various styles.

The more complex controls (just like the ListView) may be divided into smaller GUI objects that we call elements. An element can, for example, identify the column headers in a ListView or a distinct ListView item. Every element is assigned a role, e.g. "ListItem" or "ColumnHeader", out of a predefined list of possible roles that describe how the user can interact with an element.

Every control has a corresponding element object, too. And both controls and elements can contain child GUI objects. Thus, both controls and elements constitute trees of GUI objects, where the element tree has a finer granularity than the object tree.

So, in order to automate GUIs you can either use the control or the element approach, but usually you will need both of them to get everything done. E.g. searching in the control tree is much more effecient than searching for elements, because of the smaller number of controls. Then again you will need to use elements to click the column header of a ListView.

Regards,
Alex
Ranorex Support Team