Easier way to find elements than Element.FindChilld()?
Posted: Sun Sep 24, 2006 9:03 am
First of all, thanks so much for providing Ranorex for free.
Now for the question: Is there an easier way to find a form element than to use Element.FindChild()? Here's my situation:
I'm using Ranorex to parse information from a Windows form. I can access most of the form elements and output their Value properties, or Controls and their Text properties. However, I'm having trouble accessing a graphic on the form.
I've used DumpElementTree() from your sample code to output every single element from a Windows form into flat-file and imported it into Excel to analyze. (I tried using RanorexSpy but I couldn't all the elements in the form.) Looking at the data, I can see every element's Role, Name, Value, State, Class, etc. properties. However, there are numerous elements that have missing Name, Value, and other properties.
The element I'm trying to access is a Role.Graphic, but I can't use any of the overloaded Element.FindChild() methods because the element doesn't have a unique Role, it has no Name, and doesn't have a unique Class. It does, however, have a unique location. Is there any chance another overloaded Element.FindChild() method can be created that also takes the location as a parameter?
Or maybe there's some way to uniquely identify every single element in a form? Looks like Control Id doesn't always work because according to RanorexSpy, not every single element has a Control Id. I guess I could just interate through every element (like what DumpElementTree() does) and find the element manually, but it seems like there should be an easier way to do it.
Of course, once I do get access to the graphic element, is there a way to see what image it's displaying? Something like an ImageSource property for the graphic? I'm trying to find out the type of image that's being displayed without resorting to Optical Character Recognition.
Now for the question: Is there an easier way to find a form element than to use Element.FindChild()? Here's my situation:
I'm using Ranorex to parse information from a Windows form. I can access most of the form elements and output their Value properties, or Controls and their Text properties. However, I'm having trouble accessing a graphic on the form.
I've used DumpElementTree() from your sample code to output every single element from a Windows form into flat-file and imported it into Excel to analyze. (I tried using RanorexSpy but I couldn't all the elements in the form.) Looking at the data, I can see every element's Role, Name, Value, State, Class, etc. properties. However, there are numerous elements that have missing Name, Value, and other properties.
The element I'm trying to access is a Role.Graphic, but I can't use any of the overloaded Element.FindChild() methods because the element doesn't have a unique Role, it has no Name, and doesn't have a unique Class. It does, however, have a unique location. Is there any chance another overloaded Element.FindChild() method can be created that also takes the location as a parameter?
Or maybe there's some way to uniquely identify every single element in a form? Looks like Control Id doesn't always work because according to RanorexSpy, not every single element has a Control Id. I guess I could just interate through every element (like what DumpElementTree() does) and find the element manually, but it seems like there should be an easier way to do it.
Of course, once I do get access to the graphic element, is there a way to see what image it's displaying? Something like an ImageSource property for the graphic? I'm trying to find out the type of image that's being displayed without resorting to Optical Character Recognition.