Path with Reg Expression Issues

Class library usage, coding and language questions.
Murphy
Posts: 5
Joined: Wed Nov 30, 2011 6:07 pm

Path with Reg Expression Issues

Post by Murphy » Wed Dec 07, 2011 5:52 pm

I am having a hard time implementing a regular expression for some objects I am mapping. I have read through the documentation and am still unable to resolve the issue.

Object Path:
body/form/div[@id='ctl00_divContent']/div[@id='ctl00_divBody']/div/div[@id='pagewrap']/div[4]/div[@id='col1']/div[@id='gHotLoads_portlet']

The 'col1' could be col 1, 2, or 3. So I have attempted to change the 1 to .* or [1-3] with no success.

New Path:
body/form/div[@id='ctl00_divContent']/div[@id='ctl00_divBody']/div/div[@id='pagewrap']/div[4]/div[@id='col.*']/div[@id='gHotLoads_portlet']

After implementing the new path Ranorex cannot highlight the element on the screen.

Any ideas?

Thanks!

Murphy
Posts: 5
Joined: Wed Nov 30, 2011 6:07 pm

Re: Path with Reg Expression Issues

Post by Murphy » Wed Dec 07, 2011 6:09 pm

I was able to use a wildcard in this fashion:

body/form/div[@id='ctl00_divContent']/div[@id='ctl00_divBody']/div/div[@id='pagewrap']/div[4]/*/div[@id='gHotLoads_portlet']


This worked - still wondering about the regular expression issue though.

Thanks!

User avatar
sdaly
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: Path with Reg Expression Issues

Post by sdaly » Wed Dec 07, 2011 8:33 pm

You need to change the = to a ~ to use regex mode....

Alternatively you could do @id='1' or @id='2'

Murphy
Posts: 5
Joined: Wed Nov 30, 2011 6:07 pm

Re: Path with Reg Expression Issues

Post by Murphy » Wed Dec 07, 2011 8:45 pm

That worked, thanks!