Facing a problem with dynamic Id in RanoRex Path

Experiences, small talk, and other automation gossip.
ajith3201
Posts: 5
Joined: Thu May 18, 2017 2:58 pm

Facing a problem with dynamic Id in RanoRex Path

Post by ajith3201 » Thu May 18, 2017 3:14 pm

Hi Team,

We are facing an issue with Dynamic Id , where it is changing from time to time and Machine to machine
could please help me out here.
following unique Id is changing from time to time, I have added a screen shot for the same
#'uniqName_130_0'

//div[#'uniqName_130_0']/div/div[6]//table/tbody/tr[7]/td[@innertext='APPLICATION MENUS']


I have tried for the following ways by adding a condition for wights with ranorex tool from previous posts
uniqName_([0-9])*
uniqName_([0-9]+)+
uniqName_[0-9]*_[0-9]*
still they didn't work for me

Please Provide some suggestions here
Attachments
Capture.PNG
Capture.PNG (12 KiB) Viewed 1212 times

jma
Posts: 111
Joined: Fri Jul 03, 2015 9:18 am

Re: Facing a problem with dynamic Id in RanoRex Path

Post by jma » Fri May 19, 2017 11:54 am

Hi,

I would suggest using a regular expression in the path. For example, you could use the following path:

//div[@Id~'^uniqName']/div/div[6]//table/tbody/tr[7]/td[@innertext='APPLICATION MENUS']

More information about regular expressions can be found in the user guide: https://www.ranorex.com/support/user-gu ... html#c3294

I hope that helps.

ajith3201
Posts: 5
Joined: Thu May 18, 2017 2:58 pm

Re: Facing a problem with dynamic Id in RanoRex Path

Post by ajith3201 » Sun May 21, 2017 1:01 pm

Hi jma,

I have tried with the above suggestion and applied few Regex still its not finding the required element on a browser.
can get some more suggestions over here

ajith3201
Posts: 5
Joined: Thu May 18, 2017 2:58 pm

Re: Facing a problem with dynamic Id in RanoRex Path

Post by ajith3201 » Mon May 22, 2017 7:39 am

Hi Team,

In our Application there are Multiple unique Ids for a single page on each and every Div as shown in screenshot,
I need to access elements under each and every Div, Can I get some suggestions for proceeding further

I have Edited the Ranorex Path as Per Jma's Suggestions and even added few RegEx to find the required element but its unable to find the required element.

Please Provide me some suggestions ASAP.

Thanks

jma
Posts: 111
Joined: Fri Jul 03, 2015 9:18 am

Re: Facing a problem with dynamic Id in RanoRex Path

Post by jma » Mon May 22, 2017 10:24 am

Hi,

In order the community can help you resolving your issues, please upload a Ranorex Snapshot of the corresponding web element.

Information about creating a snapshot can be found under the following link: https://www.ranorex.com/support/user-gu ... pshot.html

After that, I can check why my path suggestion doesn't work.

ajith3201
Posts: 5
Joined: Thu May 18, 2017 2:58 pm

Re: Facing a problem with dynamic Id in RanoRex Path

Post by ajith3201 » Mon May 22, 2017 2:17 pm

Hi Jma,

As per security and Privacy guidelines i am not supposed to add the snapshot as you ask, but i am attaching the architecture of the required button screenshot.
//div[#'uniqName_130_1']/div/div[6]/div/div/div/div[13]/input[@type='button']

please find the attached screenshots for the same
in Snap Shot there are two snaps one is from top level parent and second one is continuation till the required button
Attachments
ButtonSnap.jpg
ButtonSnap.jpg (155.72 KiB) Viewed 1168 times

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Facing a problem with dynamic Id in RanoRex Path

Post by Vaughan.Douglas » Mon May 22, 2017 2:43 pm

This is really challenging without the snapshot, but I completely understand why you can't provide it. Sometimes it can help to start backwards. For example how many elements do you get when you use just

Code: Select all

//td[@innertext='APPLICATION MENUS']
Doug Vaughan

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3908
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Facing a problem with dynamic Id in RanoRex Path

Post by odklizec » Mon May 22, 2017 2:45 pm

Hi,

Unfortunately, a screenshot is useless here. It does not provide enough information about the problematic xpath and it does not allow us to test it. If the regex you are trying is correct, then there must be a problem with something else in your xpath (my guess div indexes). But without the ability to test the xpath and regexes against the snapshot, there is almost nothing anyone here can do, except wild guesses. If you are not allowed to post a snapshot publicly, try contact Ranorex support at [email protected]. They may help you via remote session.

Anyway, I would suggest you to check this blog post, describing how to work with dynamic IDs:
https://www.ranorex.com/blog/automated- ... namic-ids/
Maybe it would be better for you to use another identification attributes (e.g. class), instead of "not-so-unique" IDs ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration