[python-win32] Problems with QuickTest Automation Object Model
Tim Roberts
timr at probo.com
Tue Sep 8 19:36:11 CEST 2009
Dennis Chung wrote:
> Thanks Tim.
>
> I apologize in advance if this doesnt thread properly; I'm on the
> digest list and am not sure how to properly reply to individual messages.
>
> I am now able to launch the application via python win32com however I
> am still having an issue. The QuickTest.Application object allows me
> to run open test scripts and run as follows:
>
> import win32com.client
> o = win32com.client.Dispatch("QuickTest.Application")
> o.Launch()
> o.Open("V:\tests\mytest")
> o.Test.Run(o.Test)
I hope that's not really what your code says, because the file name you
are passing contains a "tab" character. You need one of these instead:
o.Open( "V:/tests/mytest" )
o.Open( r"V:\tests\mytest" )
o.Open( "V:\\tests\\mytest" )
> In vbscript, I am able to call the Run method of the Test object
> without any parameters and the it appears that "self" is passed
> implicitly. Calling Run without any parameters in python yields:
>
> >>>o.Test.Run()
> Traceback (most recent call last):
> File "<pyshell#17>", line 1, in <module>
> o.Test.Run()
> File "<COMObject <unknown>>", line 3, in Run
> TypeError: The Python instance can not be converted to a COM object
>
> Could it be that python is passing the python instance to Run method
> rather than the COM instance?
No. The more likely answer is that the Run command failed because the
file name was invalid, so o.Test is not returning a real object.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list