Page 1 of 1

gets and ID using ranorex

Posted: Tue Oct 17, 2017 10:39 am
by alexlosk
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?

Re: gets and ID using ranorex

Posted: Tue Oct 17, 2017 5:47 pm
by Support Team
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