Micro Focus QTP (UFT) Forums

Full Version: Error while creating object using description.create object in VB script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
Dim objVar
set objVar=description.create

After executing this code its showing the error.

Object required description
I am not getting any error.

Can you brief out exactly what are you trying to do ?
'Create a description for browser

Code:
Set oBrowser = Description.Create
oBrowser("micclass").Value = "Browser"

'Get all browsers
Set allBrowser = Desktop.ChildObjects(oBrowser)

Dim i, iCount

iCount = allBrowser.Count - 1

For i = 0 To iCount
    
allBrowser(i).Close
  
Next




After executing the above code I am getting the error as "Object required 'Description'
I tried ur code and it is perfectly working.

R u executing the below thru QTP or .vbs file ?
I am not using QTP. I am using .vbs file.
I think Description.Create does not support in .vbs file as it belongs to QTP.

Try below code to close all browsers thru .vbs file

Code:
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colProcesses = objWMIService.ExecQuery( "Select * from Win32_Process where name = 'iexplore.exe'")
For Each objProcess in colProcesses
objprocess.terminate
Next
Set colProcesses = Nothing
Set objWMIService = Nothing