Ranorex.Form="xxxxxxxx"

Ask general questions here.
marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

Ranorex.Form="xxxxxxxx"

Post by marcushe » Wed Jun 17, 2009 8:18 am

Environment:Win7 US,Ranorex2.1
Application: DxDiag.exe
I don't see any introduction for this kind of usage of Ranorex.Form.
i use it in my project like this ,but it failed:
// click display tab
Ranorex.Text t="/form[@title='DirectX Diagnostic Tool']/container/text[@controlid='5008']"
RegularStr="No problems found.*";
...
if (Regex.IsMatch(t.TextValue,RegularStr,RegexOptions.IgnoreCase)
{

}
//click sound tab
if (Regex.IsMatch(t.TextValue,RegularStr,RegexOptions.IgnoreCase)
{

}
//click input tab
if (Regex.IsMatch(t.TextValue,RegularStr,RegexOptions.IgnoreCase)
{

}
i find the match always fail. Did i miss some steps???
If use Host.Local.FindSingle or Find<T>(..,..) ,it works well

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

Re: Ranorex.Form="xxxxxxxx"

Post by Support Team » Thu Jun 18, 2009 2:47 pm

The direct assignment of an RxPath to an adapter/element is equivalent to calling FindSingle("myRxPath", Adapter.DefaultSearchTimeout). I don't see why that should make a difference in your Regex.Match calls. Once you make those calls, the element should already be found.

Could you please clarify what you mean by "match always fails"? Please, check whether the element t is found and what its TextValue is!

Regards,
Alex
Ranorex Support Team
.
Image

marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

Re: Ranorex.Form="xxxxxxxx"

Post by marcushe » Fri Jun 19, 2009 2:00 am

Thanks, I think i found the root cause.
On 'DirectX Diagnostic Tool', on Display/Sound/Input they all use Control, which has controlID=5008 to show 'No Error Found.'.
My actions is as below:
1. Click display
Ranorex.text t="/form[@title='DirectX Diagnostic Tool']/container/text[@controlid='5008']"
string s=t.textvalue
2. click sound
' note, here i didn't use t="/form[@title='DirectX Diagnostic Tool']/container/text[@controlid='5008']"
'again
s=t.textvalue
3. click input
s=t.textvalue
If i use t="xxxx" at step2 and 3 ,it's OK
So ,it 's the reason that result in