Accessing Methods of ActiveX Objects

By XeroCube | May 28, 2008

I have been using QuickTest Pro for several years now and have just discovered a simple, but highly useful, feature. In dealing with ActiveX controls, there are many times when the ActiveX add-in for QTP just doesn’t full recognize an application object.

Using the ObjectSpy, you can select the object in question and see all the runtime properties and methods available for the object. For the longest time, I had been using the GetROProperty() method to retrieve the values of the properties. However, I’d not considered how to execute the methods of the objects, as I never needed to do that.

It turns out that you can access the methods, and properties, of the object with this simple code snippet:


VbWindow("frmWindow").ActiveX("testObject").Object.methodName()
VbWindow("frmWindow").ActiveX("testObject").Object.Property

Happy Testing!

Topics: QuickTest Pro | No Comments »

Comments

Archives

Blogroll

RockinMedia