The Reson why i say its not simple is :
1. it has to close tabs if present in the open IE sessions .
2. sometimes when you Already have any broser session is open and then you invoke the tool it recognises it as window object .
3. The code given above is in javascript and i only use vbscript in my project .
4. i have wriiten a nice code in vbscript long back , it works fine in QTP , but when i tried to run it in test complete it dosnt work .
5. I am aware that there is difference in syntax of passing the Description of the object in qtp and test complete and i have changed that too .
6.but still dosn`t work as Desstop.childobjects in qtp gives you all childobject filter by all IE sessions , but no such method avalioble in tc ...
'==================Original QTP Code==========================
'Function Close_AllBrowser()
'Set oBrowser = Description.Create
'oBrowser("micclass").Value = "Window"
'oBrowser("regexpwndtitle").Value = ".*Internet Explorer.*"
'
'Set oDialog = Description.Create
'oDialog("micclass").Value = "Dialog"
'oDialog("text").Value = "Internet Explorer"
'oDialog("is owned window").Value = "True"
'oDialog("is child window").Value = "False"
'
'
' Set oBrowserList = Desktop.ChildObjects(oBrowser)
'
' Select Case oBrowserList.count
'
' Case 0
' Case 1
' If Instr(oBrowserList(0).GetROProperty("text"), "Application Lifecycle Management") = 0 Then
' oBrowserList(0).Close
' wait(1)
' If oBrowserList(0).Dialog(oDialog).Exist(0) then
' oBrowserList(0).Dialog(oDialog).WinCheckBox("text:=&Always close all tabs", "nativeclass:=Button").Set "ON"
' oBrowserList(0).Dialog(oDialog).WinButton("regexpwndtitle:=Close all &tabs", "text:=Close all &tabs").Click
' End if
' End if
'
' Case Else
' For index = 0 to oBrowserList.count-1
' If Instr(oBrowserList(index).GetROProperty("text"), "Application Lifecycle Management") = 0 Then
' oBrowserList(index).Close
' wait(1)
' If oBrowserList(index).Dialog(oDialog).Exist(0) then
' oBrowserList(index).Dialog(oDialog).WinCheckBox("text:=&Always close all tabs", "nativeclass:=Button").Set "ON"
' oBrowserList(index).Dialog(oDialog).WinButton("regexpwndtitle:=Close all &tabs", "text:=Close all &tabs").Click
' End if
' End if
' Next
'
' End Select
'
' Set oBrowser =Nothing
'
' Set oDialog = Nothing
'End Function
'==============================================================