FindSingle method : Automation API

FindSingle method

Class library usage, coding and language questions.

FindSingle method

Postby atom » Thu Oct 01, 2009 2:20 pm

Hiya

Can you explain the different between:

myForm.FindSingle(of ranorex.text)("container/text[@controlid='102']")

and

myForm.FindSingle(of ranorex.text)("descandant::text[@controlid='102'")

I would of thought they are the same, but infact the first one fails, and the second one works
atom
 
Posts: 339
Joined: Mon Dec 08, 2008 12:14 am
Location: Dublin, Ireland

Re: FindSingle method

Postby Support Team » Thu Oct 01, 2009 3:07 pm

"descendant::..." means any child, grand child, or grand grand child, ... - so the whole subtree is searched. "/" or "child::..." corrsponds only to direct children.

Regards,
Alex
Ranorex Support TEam
User avatar
Support Team
Site Admin
 
Posts: 4842
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: FindSingle method

Postby atom » Thu Oct 01, 2009 3:09 pm

Yes i agree but what does FindSingle need this?
atom
 
Posts: 339
Joined: Mon Dec 08, 2008 12:14 am
Location: Dublin, Ireland

Re: FindSingle method

Postby Support Team » Thu Oct 01, 2009 4:15 pm

I don't really understand your question, sorry!
FindSingle searches for the specified path and returns the first matching element. If in your case the first path does not work, but the second one does, it looks like the element you are searching (with controlId '102') is not inside that container (as the first path assumes), but somewhere deeper in the element tree.

Regards,
Alex
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4842
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests