RanorexPath not working

Ask general questions here.
rkarhe
Posts: 42
Joined: Thu Jul 28, 2011 5:31 am

RanorexPath not working

Post by rkarhe » Tue Aug 23, 2011 6:26 am

Hi Experts,

I have a ui element having innertext as 'New Search', RanorexPath I have written for this element is ".//span[@innertext~'^New\\ Search$']". But somehow ranorex is not able to find out element using this path, it clicks somewhere else on ui. Anybody plese suggest me what is going wrong here.
I am stuck due to this.

Thanks,
Rocky

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: RanorexPath not working

Post by Support Team » Tue Aug 23, 2011 9:11 am

Hi,

Why do you use a regex for this element? If you use span[@text='New Search'] then the element should be always found. I think you get an exception if you execute your RegEx in code, because you search for an element with the name "New \ Search" and I think this couldn't be found. Would it be possible to post us a Ranorex Snapshot of your New search element then I could provide you a few possibilities to search for your element.
How to create a Ranorex Snapshot
I would suggest you to read following blog too
http://www.ranorex.com/blog/ranorexpath-tips-and-tricks

Regards,
Peter
Ranorex Team
.
Image

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: RanorexPath not working

Post by Aracknid » Wed Aug 24, 2011 4:36 pm

In your posted example, you have too many backslashes...

".//span[@innertext~'^New\\ Search$']" >>> should be ".//span[@innertext~'^New\ Search$']"

Also, you are searching for any span from the level of a current object (by using .//), so hopefully that is what you want to do.

Aracknid