Hi,
I'm having trouble getting the text value from a UI element in my program. There is a TextBoxMaskBox that is nested inside a DevExpress.XtraEditors.DateEdit item. The DateEdit item has no .TextValue extension in code for me to access, and the MaskBox does not recognise that it has text (in Ranorex Properties the Text field is blank).
Here is a picture of the DevExpress DateEdit element and the properties in Studio:
And here is the Xpath that I use to get the maskbox:
/form[@controlname='MainForm']/element/form/container[@controlname='dockPanel1']/container/container[@controlname='gcTimePeriod']/element[@controlname='dateEditTimePeriodStart']/text[@controltypename='TextBoxMaskBox']
Thanks,
Ryan
Cannot get text value from TextBoxMaskBox
Re: Cannot get text value from TextBoxMaskBox
I use those in my AUT as well. If you know the RXPath to the TextBoxMaskBox, then get the parent element. The parent element should have the text in the ControlText attribute.
Code: Select all
Ranorex.Core.Element ParentElement = YOUROBJECT.Element.Parent;
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: Cannot get text value from TextBoxMaskBox
Ciege,
Thank you for your response. I tried your code and it finds the parent successfully. But there is no ControlText attribute for me in the parent. Additionally I know the XPath for the parent so finding it isn't a problem. But there does not seem to be any text, although clearly there is (on the app you can type text in to change the date, copy/paste etc).
Thank you for your response. I tried your code and it finds the parent successfully. But there is no ControlText attribute for me in the parent. Additionally I know the XPath for the parent so finding it isn't a problem. But there does not seem to be any text, although clearly there is (on the app you can type text in to change the date, copy/paste etc).
Re: Cannot get text value from TextBoxMaskBox
Have you checked all the object properties and attributes from RXSpy?
Can you post an RXSpy snapshot here so we can take a look at it?
Can you post an RXSpy snapshot here so we can take a look at it?
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...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Cannot get text value from TextBoxMaskBox
Hi,
http://www.ranorex.com/Documentation/Ra ... eValue.htm
In this method you can use the Attributes of RxPath as you would identify an item in SPY
For example element[@controlname=''].
Sample code:
Peter
Ranorex Support Team
Please see following link in API Documentation:rholyk wrote:I found that the top level element has a Controltext value that is what I need. But I still can't find it in the code. Here is the Spy screenshot you requested.
http://www.ranorex.com/Documentation/Ra ... eValue.htm
In this method you can use the Attributes of RxPath as you would identify an item in SPY
For example element[@controlname=''].
Sample code:
Text textLayoutMainDemo = "yourPathto/text[@controltypename='TextBoxMaskBox']"; Ranorex.Core.Element elem = textLayoutMainDemo.Element.Parent; Console.WriteLine(elem.GetAttributeValue("controltext"));Regards,
Peter
Ranorex Support Team
Re: Cannot get text value from TextBoxMaskBox
Thanks Peter! Your method worked perfectly.