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
Object Identification using Screen position
-
- Posts: 7
- Joined: Tue Sep 21, 2010 8:02 am
Object Identification using Screen position
You do not have the required permissions to view the files attached to this post.
Re: Object Identification using Screen position
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 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...
Ciege...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Object Identification using Screen position
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.:
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
Code: Select all
.../element/form[@name='Module1']/element/text[@name='Gain']/following-sibling::text
http://www.ranorex.com/support/screencasts.html
http://www.ranorex.com/support/user-gui ... xpath.html
Regards,
Alex
Ranorex Team
Re: Object Identification using Screen position
Oooh! Thats a good one!Support Team wrote:following-sibling::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...
Ciege...
-
- Posts: 7
- Joined: Tue Sep 21, 2010 8:02 am
Re: Object Identification using Screen position
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
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Object Identification using Screen position
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:
Regards,
Tobias
Ranorex Support Team
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]
Tobias
Ranorex Support Team
-
- Posts: 7
- Joined: Tue Sep 21, 2010 8:02 am
Re: Object Identification using Screen position
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
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Object Identification using Screen position
Hi,
please try the following path
Best Regards,
Martin
Ranorex Support Team
please try the following path
Code: Select all
.../element/text[@name='Gain']/following-sibling::cell[true=true][1]
Martin
Ranorex Support Team