Ranorex

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

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
pizzaguy



Joined: 24 Sep 2006
Posts: 3

PostPosted: Sun Sep 24, 2006 10:03 am    Post subject: Easier way to find elements than Element.FindChilld()?
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.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sun Sep 24, 2006 1:44 pm    Post subject:
> 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: click into code to enlarge
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
Back to top
View user's profile Send private message Visit poster's website
pizzaguy



Joined: 24 Sep 2006
Posts: 3

PostPosted: Sun Sep 24, 2006 9:15 pm    Post subject:
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: click into code to enlarge
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: click into code to enlarge
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
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Mon Sep 25, 2006 8:59 pm    Post subject:
You are right, we will implement a new overloaded FindChild method with location:

Code: click into code to enlarge
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?
Back to top
View user's profile Send private message Visit poster's website
pizzaguy



Joined: 24 Sep 2006
Posts: 3

PostPosted: Sun Oct 01, 2006 8:53 am    Post subject:
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.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sun Oct 01, 2006 11:39 am    Post subject:
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/RanorexCore-0.9.4-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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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