Page 1 of 1

Cannot get text value from TextBoxMaskBox

Posted: Fri May 28, 2010 8:13 pm
by rholyk
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:

Image

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

Re: Cannot get text value from TextBoxMaskBox

Posted: Fri May 28, 2010 8:30 pm
by Ciege
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;

Re: Cannot get text value from TextBoxMaskBox

Posted: Thu Jun 03, 2010 9:45 pm
by rholyk
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).

Re: Cannot get text value from TextBoxMaskBox

Posted: Thu Jun 03, 2010 9:54 pm
by Ciege
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?

Re: Cannot get text value from TextBoxMaskBox

Posted: Fri Jun 04, 2010 12:40 am
by rholyk
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.

Image

Re: Cannot get text value from TextBoxMaskBox

Posted: Fri Jun 04, 2010 12:06 pm
by Support Team
Hi,
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.
Please see following link in API Documentation:
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

Posted: Fri Jun 04, 2010 10:58 pm
by rholyk
Thanks Peter! Your method worked perfectly.