QTP_用eclipse第二次启动QTP遇到的问题

源代码:

import win32com, win32com.client
qtp = win32com.client.Dispatch("QuickTest.Application")
i=1
while(i<3):  
# starts up QTP
    qtp.Launch()
# make the QTP window visible
    qtp.Visible = True
# Open a test, replace the path
    qtp.Open('E:\\HPQTPWorkspace\\openCMD%d'%(i))
# to open a QTP test in Quality Center
# qtp.Open(r"[QualityCenter] Subject\FolderName\QTPScript")
# create a RunResultsOptions object
    qtResultsOpt = win32com.client.Dispatch("QuickTest.RunResultsOptions")
# set the location to where the results will be save
    qtResultsOpt.ResultsLocation = "E:\\HPQTPWorkspace\\openCMD%d\\Res1"%(i)
    qtp.Test.Run(qtResultsOpt)
    print "Test has %s" %qtp.Test.LastRunResults.Status
# close the Test
    qtp.Test.Close()
# quit QTP
    qtp.Quit()


问题描述: 

Traceback (most recent call last):
  File "D:\AndroidWorkspace\pythonTest\com\test\runQTP.py", line 6, in <module>
    qtp.Launch()
  File "<COMObject QuickTest.Application>", line 2, in Launch
pywintypes.com_error: (-2147417851, '\xb7\xfe\xce\xf1\xc6\xf7\xb3\xf6\xcf\xd6\xd2\xe2\xcd\xe2\xc7\xe9\xbf\xf6\xa1\xa3', None, None)  

你可能感兴趣的:(eclipse,object,Module,File,Path,import)