Easier way to find elements than Element.FindChilld()?

Class library usage, coding and language questions.
pizzaguy
Posts: 3
Joined: Sun Sep 24, 2006 8:16 am

Easier way to find elements than Element.FindChilld()?

Post by pizzaguy » 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.

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Sun Sep 24, 2006 12:44 pm

> Is there any chance another overloaded Element.FindChild() method can be created that also takes the location as a parameter?

Some other users posted also the problem with Elements they have no Name, but a unique position. We will implement some functions in a future version ( >= V0.9.4 ) to retrieve the Element object at a specified position in a control or in a form.

For example, the control class will have a method:

Code: Select all

public Element GetElementFromPoint(Point point);

> Is there a way to see what image it's displaying?

It's no problem if your company develop the application.
The developer should set the value property of the image to the image name and you can read the property of the element if you automate or test the application with Ranorex.

Jenö Herget
Ranorex Team

pizzaguy
Posts: 3
Joined: Sun Sep 24, 2006 8:16 am

Post by pizzaguy » Sun Sep 24, 2006 8:15 pm

admin wrote:We will implement some functions in a future version ( >= V0.9.4 ) to retrieve the Element object at a specified position in a control or in a form.
One of the overloaded methods already takes:

Code: Select all

public Element FindChild(
   Role role,
   string name,
   string className
);
Do you think the new method can just use the same parameter list as the method above, but with the addition of the position/location?

Code: Select all

public Element FindChild(
   Role role,
   string name,
   string className,
   Point location
);
This way, there's a better chance of uniquely identifying the element. For example, the Windows form I'm looking at has several elements that have the exact same position, so calling Element.FindChild(Point location) might return just one of the several elements that share the same location.
admin wrote:> Is there a way to see what image it's displaying?

It's no problem if your company develop the application.
The developer should set the value property of the image to the image name and you can read the property of the element if you automate or test the application with Ranorex.
Unfortunately, it's 3rd party application. The value property of the image is blank. Are there any other Element properties that can be exposed in addition to the current ones (Class, DefaultAction, Description, GetChildCount, Help, Location, Name, Role, Size, State, Value) that might help find out the image source?

Thanks

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Mon Sep 25, 2006 7:59 pm

You are right, we will implement a new overloaded FindChild method with location:

Code: Select all

public Element FindChild( 
   Role role, 
   string name, 
   string className, 
   Point location 
);
RanorexCore identifies the elements internally also by Name, Role, ClassName and Location, it's the only possibility to identify uniquely an element.
pizzaguy wrote:Are there any other Element properties that can be exposed in addition to the current ones (Class, DefaultAction, Description, GetChildCount, Help, Location, Name, Role, Size, State, Value) that might help find out the image source?
Not at the moment, but there are some other possibilities to get information from an other process (in which your 3rd party application runs). We are just working on a new feature, but this will work only for managed code.
Is your 3rd party application a managed application?

pizzaguy
Posts: 3
Joined: Sun Sep 24, 2006 8:16 am

Post by pizzaguy » Sun Oct 01, 2006 7:53 am

admin wrote:
pizzaguy wrote:Are there any other Element properties that can be exposed in addition to the current ones (Class, DefaultAction, Description, GetChildCount, Help, Location, Name, Role, Size, State, Value) that might help find out the image source?
Not at the moment, but there are some other possibilities to get information from an other process (in which your 3rd party application runs). We are just working on a new feature, but this will work only for managed code.
Is your 3rd party application a managed application?
No, unfortunately it's not a managed application. Do you have an estimate on when the next version will be out? Thanks.

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Sun Oct 01, 2006 10:39 am

pizzaguy wrote:Do you have an estimate on when the next version will be out? Thanks.
I'm sorry, but i don't know at the moment.
We have made a V0.9.4-Beta1 last week:

http://www.ranorex.com/download/Ranorex ... -Beta1.zip

We are working on some new features at the moment and we have also some feature requests.
I hope we can make the next Beta 'V0.9.4-Beta2' with the new overloaded FindChild function next week.

Jenö Herget
Ranorex Team