Micro Focus QTP (UFT) Forums
Error: The systemcannot locate the object specified happened - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Error: The systemcannot locate the object specified happened (/Thread-Error-The-systemcannot-locate-the-object-specified-happened)



Error: The systemcannot locate the object specified happened - alin - 12-15-2011

[1] I wrote one vbs file to launch QTP and run test cases
Code:
Dim qtApp
    Dim qtTest
    Dim qtResultsOpt
    Dim scriptPath
    Dim ResultPath
    Dim qtpLogPath
    ezscriptPath = "C:\Users\admin\Desktop\Study\Test_try"
    ezResultPath = "C:\Users\admin\Desktop\Study\TestResult"
    
    Set qtApp = CreateObject("QuickTest.Application")
    qtApp.Launch
    qtApp.Visible = True ' Make the QuickTest application visible
        wscript.sleep 10000
    ' Set QuickTest run options
    qtApp.Options.Run.CaptureForTestResults = "OnError"
    qtApp.Options.Run.RunMode = "Normal"
    qtApp.Options.Run.ViewResults = False

    qtApp.Open ezscriptPath, True ' Open the test in read-only mode
    ' set run settings for the test
    Set qtTest = qtApp.Test
    
    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 = ezResultPath ' Set the results location
    qtTest.Run qtResultsOpt ' Run the test
    MsgBox 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
[2]. It can works well on 64bit OS
[3]. but error happened when i changed the test path and ran it on 32bit OS "The systemcannot locate the object specified" , sometimes, error is "cannot open test".
I checked the error line: qtApp.Open ezscriptPath, True

It could work if i launched QTP first.

Could you help me to check this problem? thanks~


RE: Error: The systemcannot locate the object specified happened - ravi.gajul - 12-15-2011

ezscriptPath = "C:\Users\admin\Desktop\Study\Test_try"
Looks like the path mentioned above is not correct.Please go to testscript location and copy the path and check if its the same.


RE: Error: The systemcannot locate the object specified happened - alin - 12-16-2011

>>>
I checked my path,it's correct.
because the script can be ran well if i launched QTP first manually. the problem just happened when I stop the QTP process and let vbscript to launch QTP and run test cases 。



and sometimes
"Error: Cannot open test
Code: 800A03EE" happened


RE: Error: The systemcannot locate the object specified happened - alin - 12-16-2011

I used QTP11