Page 1 of 1

Regular Expression on DIV TAG

Posted: Tue Oct 12, 2010 9:30 am
by dal
Team,

We have some objects RxPath starts with the following:

body/form/div[2]/div[@id='00_Home']/

I know how to use RegEx for this (div[@id='00_Home']/) DIV TAG.

How can I do for div[2]/

Since there are cases, other RxPath is similar in few objects in my application, only this is changing, is there a way to do like this -- div[2|3|4]/ OR div[0-9]/, but its not been accepted by the Tool.

Regards,
Dal...

Re: Regular Expression on DIV TAG

Posted: Tue Oct 12, 2010 10:37 am
by Support Team
Hi,

the RegExps evaluation only works for comparisions on attributes. But you can use the attribute child index for your objects. The only thing to be carefull with is the fact, that the attribute childindex starts at '0' not at '1' as in the array-style notation you tried to use. So for div[2]/ you have to write div[@childindex='1']/.

Regards

Tobias
Ranorex Team

Re: Regular Expression on DIV TAG

Posted: Fri Jan 17, 2014 12:07 pm
by midocap
but the issue if i use the Childindex the project didn't run do you know what is the soultion

Re: Regular Expression on DIV TAG

Posted: Mon Jan 20, 2014 1:49 pm
by mebner
Hi,

May I ask you to send us more information about the issue?
Where do you use the childindex, for which element and what exactly didn't run?
Do you get an exception when you run the solution?
If yes, could you send us the message?

Thanks,
Markus

Re: Regular Expression on DIV TAG

Posted: Wed Mar 12, 2014 3:18 pm
by mzperix
If there is only one div with @id='00_Home' attribute, then you could just delete the index like this:

old:
body/form/div[2]/div[@id='00_Home']/

new:
body/form/div/div[@id='00_Home']/

Ranorex will now go and search the elements on the body/form/div/div path, and gives the first catch, that has the attribute @id='00_Home'

Hope this helps :)