code to Identify type of object - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: code to Identify type of object (/Thread-code-to-Identify-type-of-object) |
code to Identify type of object - BVVPrasad - 07-24-2010 Is there any function that returns the type of object. For example edit box on a windows application falls under "WinEdit" Class. So can some one help me with a function/method which returns the class of the object RE: code to Identify type of object - supputuri - 07-26-2010 Hi Prasad, msgbox ObjectType(Window("").winEdit("")) Code: Public ObjectType(strobjPath) RE: code to Identify type of object - BVVPrasad - 07-27-2010 Hi Supputuri, Thanks for your response. The above code returns WinEdit when I pass Dialog("Login").WinEdit("Agent Name:") as parameter to ObjectType Function. My requirement is, I will pass the Window Name i.e "Login" and object name i.e "AgentName: " Is there any way to get what class of objects they are. Dialog for "Login" and WinEdit for "Agent Name: " Thanks, Prasad RE: code to Identify type of object - PrabhatN - 07-27-2010 Hi Prasad, You can try the following piece of code. But before trying make sure that all the properties are present that are being used over here. Or you can change it according to your application Code: Function returnObjClass(ByVal windName,ByVal objName) Then from QTP call the function as follows: Code: getClassName = returnObjClass("Your Window Name","Your Object Name") Hope it will serve to your need. RE: code to Identify type of object - BVVPrasad - 07-28-2010 Thank You Very Much Prabhat. I tried your function and it solved my problem . I used "attached text" instead of "name" for the below line obj("name").Value = objName |