| View previous topic :: View next topic |
| Author |
Message |
chall
Joined: 20 Aug 2007 Posts: 15
|
Posted: Fri Sep 07, 2007 4:53 pm Post subject: Selecting Unidentifiable Controls |
|
**Situation**
User wants to automate clicking 3 check boxes that are located in various positions on a form, though they share the same screen position, points, or coordinates and visible properties are false.
The 3 check boxes do not have unique IDs or names that would allow user to identify them. As a matter of fact, they share a control ID with a visible button. But in addition to control ID and control type, they have the same role, which is also shared by other controls on the form.
What sets the check boxes apart from the other controls on the form is their handler, though it changes every time the application is restarted. One final significant point is that although there are more that one check box that share the same attributes, it appears the form does not recognize them as separate entities.
I tried using the recorder to generate the code and to determine where I was making my mistake, but it met with the same results as I did: it selected the button instead of the check box.
How do I automate clicking check boxes that do not have a unique control ID or name, dispersed in different sections of a form and whose roles are the same as other controls on the form? |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Fri Sep 07, 2007 5:44 pm Post subject: |
|
One suggestion:
You can read all children of the form with the function form.Children:
Code: click into code to enlarge
foreach (Control child in form.Children)
{
Console.WriteLine("Handle={0} Text={1}", child.Handle, child.Text);
if( child is CheckBox )
Console.WriteLine(" CheckBox Handle={0} Text={1}", child.Handle, child.Text);
}
Jenö
Ranorex Team |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|