Hiya
A Label and a TextBox both seem to get mapped to Ranorex.Text
However it seems the Caption property is only there for Label's, and not TextBoxes
Im looking for the RxPath to select only TextBoxes
The following doesnt seem to work (xpath error):
myForm.Find(of ranorex.text)("descendant::text[@Caption string-length()>0]")
any idea how i can do that?
Thanks
TextBox and Label distinguishing
Re: TextBox and Label distinguishing
In my AUT, while both Labels and TextBoxes are of type Ranorex.text, the ControlType & ControlTypeName is different for each.
Labels
ControlType = System.Windows.Forms.Label
ControlTypeName = Label
TextBoxes
ControlType = System.Windows.Forms.TextBox
ControlTypeName = TextBox
So you should be able to query off of one of thos attributes.
Labels
ControlType = System.Windows.Forms.Label
ControlTypeName = Label
TextBoxes
ControlType = System.Windows.Forms.TextBox
ControlTypeName = TextBox
So you should be able to query off of one of thos attributes.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: TextBox and Label distinguishing
Hiya
Unfortunately this property is only for UI Automation elements, mine are MFC !
Cheers
Unfortunately this property is only for UI Automation elements, mine are MFC !
Cheers
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: TextBox and Label distinguishing
There is no "string-length" operation in RanoreXPath, but you can use "not equals" operator (!=) to check for non-empty strings:atom wrote:myForm.Find(of ranorex.text)("descendant::text[@Caption string-length()>0]")
myForm.Find(of ranorex.text)("descendant::text[@Caption!='']")Ranorex.Text "Caption" vs "Text" attribute:
In general, the "Caption" attribute is only set for static text controls like labels, the "Text" attribute is set for every element with Role Ranorex.Text. What is considered a static text control may differ by technology, but these are the standard rules for all technologies.
These attributes are only available for .NET System Windows Forms controls.Ciege wrote:ControlType & ControlTypeName
You can use the "class" ("NativeWindow" capability) or the "Role" ("Accessible" capability) attribut to distinguish static and non-static text controls in MFC applications.atom wrote:Unfortunately this property is only for UI Automation elements, mine are MFC!
Regards,
Alex
Ranorex Support Team