FindSingle method

Class library usage, coding and language questions.
atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

FindSingle method

Post by atom » Thu Oct 01, 2009 1: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

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

Re: FindSingle method

Post by Support Team » Thu Oct 01, 2009 2: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
.
Image

atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Re: FindSingle method

Post by atom » Thu Oct 01, 2009 2:09 pm

Yes i agree but what does FindSingle need this?

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

Re: FindSingle method

Post by Support Team » Thu Oct 01, 2009 3: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
.
Image