Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URGENT: ActiveX component can't create object
#1
Not Solved Exclamation 

I created a test in QTProff and then tried to run the test from the command prompt through this script.

I fired the commands from C prompt:
1) cscript //nologo C:\Daily_Status_Checkout\Daily_Checkout.vbs

Where C:\Daily_Status_Checkout is my QTP script test location and Daily_Checkout.vbs is the script mentioned below.

Gave below mentioned error -
C:\Daily_Status_Checkout\Daily_Checkout.vbs(5, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'QuickTest.Application'

2) wscript C:\Daily_Status_Checkout\Daily_Checkout.vbs

Gave the attached error in a picture file.

C:\Daily_Status_Checkout\Daily_Checkout.vbs file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code:
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible

' Set QuickTest run options
qtApp.Options.Run.ImageCaptureForTestResults = "OnError"

qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False

qtApp.Open "C:\Daily_Status_Checkout", True ' Open the test in read-only mode

' set run settings for the test
Code:
Set qtTest = qtApp.Test
qtTest.Settings.Run.IterationMode = "rngIterations" ' Run only iterations 2 to 4
qtTest.Settings.Run.StartIteration = 2
qtTest.Settings.Run.EndIteration = 4
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs

Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "C:\Daily_Status_Checkout\DSCRes1" ' Set the results location
qtTest.Run qtResultsOpt ' Run the test

WScript.StdOut.Write "Status is :" & qtTest.LastRunResults.Status ' Check the results of the test run
qtTest.Close ' Close the test

Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please help me in running this automatically. I have tried adding some snippets as well to the script as shown below to kill any running session of QTProff.

Code:
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill
strComputer = "."
strProcessKill = "'QTPro.exe'"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next

which also gave me the same error, asserting the fact that this was not the issue. So someone please guide me.


Attached Files Image(s)
   
Reply
#2
Not Solved
Were you able to run same script, previously?
If so, then it could be timing issue, QTP might be taking more time to open than expected.
Restart you machine, and try it again.
Reply
#3
Not Solved
I wasn't able to run the script at any time. I am getting this error from the time I tried to do this.

Also like before running every time I have checked whether QTP is running or not, and ran the script only when there are no instances of QTP running in back/foreground.

One information I would like to provide is that I don't have admin rights on the machine in which I am running this.
Reply
#4
Not Solved
which QTP version you are running.
If QTP 10.5 & below
then follow these steps
open cmd as adminstrator
"C:\Program Files\HP\QuickTest Professional\bin\QTAutomationAgent.exe.exe" /regserver

if 11.53 & above
"C:\Program Files\HP\QuickTest Professional\bin\QtpAutomationAgent.exe.exe" /regserver
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ActiveX component can't create object: 'JavaWindow' JayeshK 0 1,764 01-07-2021, 01:12 PM
Last Post: JayeshK
  Create Terminal as object dapeamel 0 3,167 02-16-2018, 07:09 PM
Last Post: dapeamel
  How to create an object for all actions excellentpawan123 1 2,786 06-05-2014, 01:50 PM
Last Post: Jay
  Issue related to dropdown selection(Please help urgent) excellentpawan123 2 4,309 05-31-2014, 12:00 PM
Last Post: excellentpawan123
  External component has thrown an exception. mharps 1 7,144 05-28-2014, 10:07 AM
Last Post: mharps

Forum Jump:


Users browsing this thread: 1 Guest(s)