gets and ID using ranorex

Ranorex Studio, Spy, Recorder, and Driver.
alexlosk
Posts: 9
Joined: Tue Oct 17, 2017 10:18 am

gets and ID using ranorex

Post by alexlosk » Tue Oct 17, 2017 10:39 am

Hi all,

I am trying to get and ID but I am not able to get it. I don't have experience with the user code, so I solution without using it would be great.

My problem comes when I try to click in a field, and this field has an ID which is always changing after refresh the website. So I tried to get this ID first without success.

My main idea is to get this id and to set it into a variable to click it. /dom[xx']//input[#set_value_input'] but I don't know how to do it.
Any idea?
You do not have the required permissions to view the files attached to this post.

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

Re: gets and ID using ranorex

Post by Support Team » Tue Oct 17, 2017 5:47 pm

Hi Alexlosk,

While this is a possible way to overcome an element with a dynamic ID, this is not the best way to do it. When creating a RanoreXPath, you should use an attribute with a static value, not a dynamic one. If you attach a Ranorex Snapshot of your AUT, I will be more than happy to provide a better RanoreXPath.

Ranorex, by default, heavily weights the ID as a good attribute to find elements since it is usually a unique static value. If you find this ID is dynamic across your AUT, you may want to change the RanoreXPath weight rules to use different attributes. This will prevent you from having to constantly edit the auto-generated RanoreXPath.

Cheers,
Ned