Page 1 of 1

Retrieve Textvalue from Container

Posted: Tue Mar 20, 2012 12:57 pm
by Bokido
Hello

I'm trying to retrieve the Textvalue of a Container in the Usercode.
But i'm not able to access the "text" Attribute for the ContainerContentElement.
I think there should be a solution for this , which i've not found out yet.

Greetings Bokido

Re: Retrieve Textvalue from Container

Posted: Tue Mar 20, 2012 1:13 pm
by Support Team
Hi,

Do you know the name of the attribute where the text is saved to?
If yes you can try to use the following method:
ContentElement.Element.GetAttributeValue("yourAttribute").ToString();
By the way please update to the actual Ranorex 3.2.2 version, here is the link.

Regards,
Markus
Ranorex Support Team

Re: Retrieve Textvalue from Container

Posted: Tue Mar 20, 2012 1:50 pm
by Bokido
Hi

No i don't.
The recorded item is a Textbox and as usual there should be a attribute which is named "Text" with the text of the Textbox but there isn't. So i guess there must be another Attribute.

Greetings Bokido

Re: Retrieve Textvalue from Container

Posted: Tue Mar 20, 2012 2:25 pm
by Support Team
Hi,
No i don't.
Can you ask your developers if they know which attribute/property holds the specific text value?

Maybe the text attribute is not available through your UIAutomation implementation, therefore please check if you can get the text with UISpy, which is a Microsoft tool and should identify all attributes if the UIA implementation is correct.
Is UISpy able to get the right text value?

Regards,
Markus
Ranorex Support Team

Re: Retrieve Textvalue from Container

Posted: Tue Mar 20, 2012 2:53 pm
by Bokido
Hi,

I just found out a method to retrieve the value.
Text textTextBox = "/dom[@caption='Microsoft Silverlight']/body/div/object/form/tabpagelist[@automationid='TabControlContentArea']/tabpage/text[8]";

string textboxvalue = textTextBox.TextValue;

with the following part i was able to get the Value of the right ContainerContentElement.

Greetings Bokido