How can i fetch ControlName at runtime ??

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Ravindra.D
Posts: 6
Joined: Fri Feb 18, 2011 1:11 pm

How can i fetch ControlName at runtime ??

Post by Ravindra.D » Tue Jun 28, 2011 2:37 am

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.
Thanks & Regards,
Ravindra Dave
Email : [email protected]

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How can i fetch ControlName at runtime ??

Post by Support Team » Tue Jun 28, 2011 10:32 am

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

Ravindra.D
Posts: 6
Joined: Fri Feb 18, 2011 1:11 pm

Re: How can i fetch ControlName at runtime ??

Post by Ravindra.D » Tue Jun 28, 2011 11:57 am

Hi,

Thanks for the prompt reply. Can you please provide sample code.
Thanks & Regards,
Ravindra Dave
Email : [email protected]

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How can i fetch ControlName at runtime ??

Post by Support Team » Tue Jun 28, 2011 12:13 pm

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