Cannot get text value from TextBoxMaskBox

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
rholyk
Posts: 4
Joined: Thu Mar 18, 2010 7:43 pm

Cannot get text value from TextBoxMaskBox

Post by rholyk » Fri May 28, 2010 8:13 pm

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

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Cannot get text value from TextBoxMaskBox

Post by Ciege » Fri May 28, 2010 8:30 pm

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...

rholyk
Posts: 4
Joined: Thu Mar 18, 2010 7:43 pm

Re: Cannot get text value from TextBoxMaskBox

Post by rholyk » Thu Jun 03, 2010 9:45 pm

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).

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Cannot get text value from TextBoxMaskBox

Post by Ciege » Thu Jun 03, 2010 9:54 pm

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?
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...

rholyk
Posts: 4
Joined: Thu Mar 18, 2010 7:43 pm

Re: Cannot get text value from TextBoxMaskBox

Post by rholyk » Fri Jun 04, 2010 12:40 am

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Cannot get text value from TextBoxMaskBox

Post by Support Team » Fri Jun 04, 2010 12:06 pm

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

rholyk
Posts: 4
Joined: Thu Mar 18, 2010 7:43 pm

Re: Cannot get text value from TextBoxMaskBox

Post by rholyk » Fri Jun 04, 2010 10:58 pm

Thanks Peter! Your method worked perfectly.