Object Identification using Screen position

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
jayam_jp22
Posts: 7
Joined: Tue Sep 21, 2010 8:02 am

Object Identification using Screen position

Post by jayam_jp22 » Tue Dec 06, 2011 4:48 pm

Hi Ranorex support team,

I have an application to be automated in which the objects do not have an UNique ID and is been identified with the numeric value in the object. The numeric value is supposed to be changing and so the object identification fails.

Can i use object identification based on position in screen and if so, can you provide me the syntax for using location or screen position in RXPath syntax?

Or is there any other method that i can use for identifying these objects?

Thanks for your effort.

Regards,
Jayaprakash R
You do not have the required permissions to view the files attached to this post.

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Object Identification using Screen position

Post by Ciege » Tue Dec 06, 2011 6:11 pm

Just a thought... Do the values have labels next to them? Like does the "50.0" have the label Gain next to it?
If so, and you're willing to write a bit of code, you can have Ranorex search for the label text. Get its relative location, then search for a text element that is just to the right or left (depending on your AUT) of that label text.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: Object Identification using Screen position

Post by Support Team » Tue Dec 06, 2011 7:29 pm

As Ciege said, if the element holding the value "50.0" is always preceded by a label element "Gain", then you can easily construct a RanoreXPath identifying the value by its label, e.g.:

Code: Select all

.../element/form[@name='Module1']/element/text[@name='Gain']/following-sibling::text
The "following-sibling::" axis tells Ranorex to search for a sibling following the "Gain" element which is also of role "text". For more information on RanoreXPath see the corresponding User Guide or watch or screen casts:
http://www.ranorex.com/support/screencasts.html
http://www.ranorex.com/support/user-gui ... xpath.html

Regards,
Alex
Ranorex Team

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Object Identification using Screen position

Post by Ciege » Tue Dec 06, 2011 7:31 pm

Support Team wrote:following-sibling::text
Oooh! Thats a good one! :D
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

jayam_jp22
Posts: 7
Joined: Tue Sep 21, 2010 8:02 am

Re: Object Identification using Screen position

Post by jayam_jp22 » Wed Dec 07, 2011 7:31 am

Hi Ciege, Hi Support team,

Thanks for your valuable inputs. That really helped me in identifying the objects.

using the following-sibling in Xpath, now Ranorex identifies all the objects under the Gain label (even the values for the other labels). I wanted to know is there any way that i can use the index of objects to identify the required object. For me i require only the 1st object of all the objects identified.

Please let me know your thoughts.

Regards,
Jayaprakash R

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

Re: Object Identification using Screen position

Post by Support Team » Wed Dec 07, 2011 2:26 pm

Hi,

if the index doesn't change within different executions of your AUT, you should not run into any issue with using the index operator in RanoreXPath to get only the 1st element:

Code: Select all

.../element/text[@name='Gain']/following-sibling::cell[@valid='true'][1]
Regards,
Tobias
Ranorex Support Team

jayam_jp22
Posts: 7
Joined: Tue Sep 21, 2010 8:02 am

Re: Object Identification using Screen position

Post by jayam_jp22 » Sat Dec 10, 2011 5:33 am

Hi Support TEam,

Thanks for your inputs. I tried the method you have suggested me and it is not identifying the 1st element alone with indexing done.

So i tried to pull the values out to IList and i'm verifying it for the 1st array only.

For now that solves my problem. Is this a recommended way to read the text value in the object?

Thanks.

Regards,
Jayaprakash R

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

Re: Object Identification using Screen position

Post by Support Team » Mon Dec 12, 2011 10:38 am

Hi,

please try the following path

Code: Select all

.../element/text[@name='Gain']/following-sibling::cell[true=true][1]
Best Regards,
Martin
Ranorex Support Team