Micro Focus QTP (UFT) Forums
Unable to Close UFT 14.53 through AOM 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Unable to Close UFT 14.53 through AOM Object (/Thread-Unable-to-Close-UFT-14-53-through-AOM-Object)



Unable to Close UFT 14.53 through AOM Object - y.srihari - 11-07-2019

Hi,

I am using UFT 14.53 Version.

we created AOM Object to launch uft tool and for test execution, and after completion of test execution uft tool needs to closed and start next iteration in the loop.

But after completion of test execution, UFT tool is not closing and UFT is throwing error as 'The operation failed because application is waiting for user input' and with error code 800A03F4

Below is the code for reference:

 Dim App, qtTest, DriverPath
 
 DriverPath = "E:\Automation\Chrome"
 intIterationCnt = 3
 intTestCnt = CInt(InputBox("Please enter the no. of test cases in the Execution Excel Sheet"))
 'intTest = intTestCnt - (intTestCnt Mod 5)
 intCnt = intTestCnt/intIterationCnt


 If InStr(intCnt,".") <> 0 Then
  intCnt = intCnt + 1
 End If

 intTest = Cint(Split(intCnt,".")(0))
 
 Redim QTP_Tests(intTest)

 For ctr = 1 To intTest

  QTP_Tests(ctr) = DriverPath & "\AllModulesExecution\Scripts\DriverScript\CompleteModulesExecution_DriverScript"
  If ctr = intTest Then
   Exit For
  End If
  lb = (ctr*intIterationCnt - intIterationCnt)+1
  ub = ctr*intIterationCnt

  For i = lb to ub
   Set App = CreateObject("QuickTest.Application")
   App.Launch
   App.Visible = True
   'Set QuickTest run options
   App.Options.Run.ImageCaptureForTestResults = "Always"
   App.Options.Run.RunMode = "Normal"
   App.Options.Run.StepExecutionDelay = 0
   App.Options.Run.ViewResults = False
   App.Options.Run.AutoExportReportConfig.AutoExportResults = True
   App.Options.Run.AutoExportReportConfig.StepDetailsReport = True
   App.Options.Run.AutoExportReportConfig.DataTableReport = False
   App.Options.Run.AutoExportReportConfig.LogTrackingReport = False
   App.Options.Run.AutoExportReportConfig.ScreenRecorderReport = True
   App.Options.Run.AutoExportReportConfig.SystemMonitorReport = False
   App.Options.Run.AutoExportReportConfig.ExportLocation = DriverPath & "\AllModulesExecution\Result\TestExecutionResult"
   App.Options.Run.AutoExportReportConfig.UserDefinedXSL = ""
   App.Options.Run.AutoExportReportConfig.StepDetailsReportType = "PDF"
   App.Options.Run.AutoExportReportConfig.StepDetailsReportFormat = "Detailed"
   App.Options.Run.AutoExportReportConfig.ExportForFailedRunsOnly = True
   wscript.sleep 1000
   App.Open QTP_Tests(ctr),True  ' Open the test in read-only mode
   Set qtTest = App.Test
   qtTest.Settings.Run.OnError = "NextStep"
   qtTest.Run ' Run the test
   qtTest.close
   wscript.sleep 1000
   App.Quit
   Set qtTest = Nothing
   Set App = Nothing
   wscript.sleep 1000
  Next
 Next


RE: Unable to Close UFT 14.53 through AOM Object - y.srihari - 12-26-2019

The above issue got resolved on replacing 'qtTest.close ' with below mention code.

Dim shell
Set shell= CreateObject("WScript.Shell")
shell.Run "taskkill /f /im uft.exe", , True