Page 1 of 1

How can i fetch ControlName at runtime ??

Posted: Tue Jun 28, 2011 2:37 am
by Ravindra.D
Hi,

I am searching for a label control at runtime using text[@controltext='Text'], After searching the control i want to fetch value of @controlname property as string. Please guide me how i can i perfrom this task.

Re: How can i fetch ControlName at runtime ??

Posted: Tue Jun 28, 2011 10:32 am
by Support Team
Hi,

to get out the attribute "controlname" from a control you can use following method from Control class:
Control.GetPropertyValue(string name)

Kind regards,
Tobias
Support Team

Re: How can i fetch ControlName at runtime ??

Posted: Tue Jun 28, 2011 11:57 am
by Ravindra.D
Hi,

Thanks for the prompt reply. Can you please provide sample code.

Re: How can i fetch ControlName at runtime ??

Posted: Tue Jun 28, 2011 12:13 pm
by Support Team
Hi,

please, read the corresponding section in the Ranorex User Guide:
http://www.ranorex.com/support/user-gui ... apter.html

BTW you can also use the Name attribute directly:
Control yourControl = "Path/to/your/text[@controltext='Text']";
String yourString = yourControl.Name;
Regards,
Tobias
Support Team