identifying defaultlabel

Ask general questions here.
Frank
Posts: 3
Joined: Tue Mar 30, 2010 9:38 am

identifying defaultlabel

Post by Frank » Tue Mar 30, 2010 2:58 pm

FindDescendant has the following parameter:

label (String)
The label to search by ('defaultlabel' attribute).


But how can I identify the defaultlabel? Is the defaultlabel always the attribute of the matching element?

e.g. in WinFormsTest

Code: Select all

/form[@controlname='Form1']/container[@controlname='groupBox2']/table/scrollbar[@pagesize='111']

pagesize ist the defaultlabel with 111?

And there could also were defaultlabels like the value of @accessiblename, @accessiblerole, @controltype, @controlname, right? But I can only use one of them?!

And other attributes are only accessible with Find and FindeSingle?

Thank you for any information.

Frank

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

Re: identifying defaultlabel

Post by Support Team » Tue Mar 30, 2010 3:48 pm

Hi,

If you are using a Find method, the better way is to use the FindSingle method. In this method it's possible to search by RanoreXPath, which let's you specify exactly the attributes used to identify the object.

e.g.
//Search for Form by identyfing the form by title
Ranorex.Form form = Host.Local.FindSingle(".//form[@title='Form1']");
FindDescendant(string) is actually an obsolete method and will be removed in future major versions of Ranorex.

Also take look to our screen casts of 'How to use RxPath'
http://www.ranorex.com/support/screencasts.html

Regards,
Peter
Ranorex Support Team
.
Image

Frank
Posts: 3
Joined: Tue Mar 30, 2010 9:38 am

Re: identifying defaultlabel

Post by Frank » Mon Apr 19, 2010 10:07 am

Thank you for the information. But one question again:
FindDescendant(string) is actually an obsolete method and will be removed in future major versions of Ranorex.
Do you have plans to remove other methods too? Like FindChild(string)?

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

Re: identifying defaultlabel

Post by Support Team » Mon Apr 19, 2010 11:09 am

Actually, I was a little to quick in stating that the FindDescendant(string) method will be removed. This method will still exist in future versions. We will improve its documentation, though :-)

Ranorex always tries to remain backwards compatible, that's why usually no methods/properties will be removed in future versions. In particular, this is true for the same major version of Ranorex, i.e. no methods/properties are to be removed in Ranorex 2.X. Instead, if we want to signal that a method is superseded, we mark it with the Obsolete attribute. (The compiler warns you if you use an Obsolete method/property). Such marked methods/properties may then be removed in the next major version of Ranorex, but still we usually refrain from doing so unless it's absolutely necessary. The Obsolete attribute is rather a note that usage of that method/property is not recommended.

Regards,
Alex
Ranorex Support Team
.
Image