Page 1 of 1

Edit JS Framework

Posted: Wed Feb 19, 2014 12:38 pm
by thecrazykaktus
Hi I have a problem with dynamic IDs. We use the JS Framework.
I have a link witch is a Button that is generated dynamically.
The example can be found here.

Code: Select all

.//div[#'ifrdiv_comcat']/iframe[@id='ifr_comcat']//a[#'form_vertical_toolbar:j_idt112:create']
How can i handle the dynamic ID? I have no other Attribute that i can use.

j_idt112

Is there a method how to

Code: Select all

j_idt112
can be replaced by a placeholder or similar?
Like this

Code: Select all

.//div[#'ifrdiv_comcat']/iframe[@id='ifr_comcat']//a[#'form_vertical_toolbar:*~~~:create']
Sorry for my English :)

Re: Edit JS Framework

Posted: Wed Feb 19, 2014 2:19 pm
by krstcs
Regular expressions (RegEx). In RanoreXPath you can use regex to do what you are wanting. Change the "=" to "~" and put the pattern you want to match in the single quotes like so:

Code: Select all

.//div[#'ifrdiv_comcat']/iframe[@id='ifr_comcat']//a[@id~'form_vertical_toolbar\:.*\:create']
(Note that I used the "\" to escape the ":" characters, since they are considered special in regex and we want to match the actual character in your pattern.)

The "#" symbol in RanoreXPath means "unique ID" so you can substitute "@id=" or "@id~", etc.

This will find all atags under the iframe with an id attribute that is similar to 'form_vertical_toolbar:<any id>:create'.

http://www.regular-expressions.info/ is a great site for understanding RegEx.

Re: Edit JS Framework

Posted: Wed Feb 19, 2014 2:40 pm
by thecrazykaktus
Thanks!