Path with Reg Expression Issues : Automation API

Path with Reg Expression Issues

Class library usage, coding and language questions.

Path with Reg Expression Issues

Postby Murphy » Wed Dec 07, 2011 6: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 7:07 pm

Re: Path with Reg Expression Issues

Postby Murphy » Wed Dec 07, 2011 7: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!
Murphy
 
Posts: 5
Joined: Wed Nov 30, 2011 7:07 pm

Re: Path with Reg Expression Issues

Postby sdaly » Wed Dec 07, 2011 9:33 pm

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

Alternatively you could do @id='1' or @id='2'
User avatar
sdaly
 
Posts: 213
Joined: Mon May 10, 2010 12:04 pm
Location: Dundee, Scotland

Re: Path with Reg Expression Issues

Postby Murphy » Wed Dec 07, 2011 9:45 pm

That worked, thanks!
Murphy
 
Posts: 5
Joined: Wed Nov 30, 2011 7:07 pm


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests

cron