How to query for a Form using substring with Ranorex 2.1.2

Ask general questions here.
cancerion
Posts: 30
Joined: Tue Jun 16, 2009 6:15 pm

How to query for a Form using substring with Ranorex 2.1.2

Post by cancerion » Wed Aug 05, 2009 12:12 pm

Hi,

I am using Ranorex 2.1.2 version
I want to know how can we search a form, control and element on basis of substring.

I know about Ranorex 1.5, I can use ‘SearchMatchMode’.

Thanks,
Sachin

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

Re: How to query for a Form using substring with Ranorex 2.1.2

Post by Support Team » Wed Aug 05, 2009 1:25 pm

Hi cancerion,
use the RxPath regular expression functionality to search for substrings like:
// e.g. Form Title: Documentation
string subStr = "menta";
string path = "/form[@title~'"+ subStr +"']";
Element elem = Host.Local.FindSingle(new RxPath(path));
Please read the Ranorex User Guide topic on regular expressions in RxPaths:
http://www.ranorex.com/support/user-gui ... html#c1791
Additional info on regular expressions can be found on MSDN:
http://msdn.microsoft.com/en-us/library/az24scfc.aspx

Regards,
Christian
Support Team
.
Image

cancerion
Posts: 30
Joined: Tue Jun 16, 2009 6:15 pm

Re: How to query for a Form using substring with Ranorex 2.1.2

Post by cancerion » Thu Aug 06, 2009 12:44 pm

It works for me.

Thanks,