'Name: platform_web_CloseAllBrowsersExceptALM ()
'Desc: Closes all browsers except ALM
'Desc: Closes all browsers except ALM
'Date Created:
'Author:
'Input Parameters: i
Public Sub platform_web_CloseAllBrowsersExceptALM ()'Author:
'Input Parameters: i
Call CloseAllBrowsersExceptALM ()
End Sub
Public Sub CloseAllBrowsersExceptALM ()
'Clean up the open browser windows from previous test
Dim vcol_Handles, vCtr, vHwnd, Flag, vLastHWnd,sCompare
vCtr = 0
Flag = 1
Set vcol_Handles = CreateObject("Scripting.Dictionary")'Clean up the open browser windows from previous test
Dim vcol_Handles, vCtr, vHwnd, Flag, vLastHWnd,sCompare
vCtr = 0
Flag = 1
While (Window("regexpwndclass:=IEFrame","index:=" & vCtr).Exist(0) And Flag)
'wait 1
vHwnd = Window("regexpwndclass:=IEFrame","index:=" & vCtr).getroproperty("Hwnd")
If (vLastHWnd=vHwnd) Then
Flag = 0
Else
vcol_Handles.Add CStr(vcol_Handles.Count),vHwnd
vCtr = vCtr+1
End If
vLastHWnd = vHwnd
Wend
'Use reverse order in this for loop so that the text and Hwnd remain in correct order after each is closed
For vCtr = vcol_Handles.Count-1 to 0 step -1
vHwnd = vcol_Handles.Item(CStr(vCtr))
' Determine if the browser window has the word ALM in the caption barFor vCtr = vcol_Handles.Count-1 to 0 step -1
vHwnd = vcol_Handles.Item(CStr(vCtr))
sALMCompareString = "HP Application Lifecycle Management"
sCompare=Instr(Window("hwnd:=" &vHwnd).getroproperty("title"),sALMCompareString)
'sCompare=Instr(Window("hwnd:=" &vHwnd).getroproperty("title"),"Quality Center")
' If it doesn't or the title bar is empty, close the window
If (sCompare=0) or (IsNull(sCompare)) then
Window("hwnd:=" &vHwnd).Close
End If
Next
End Sub
'sCompare=Instr(Window("hwnd:=" &vHwnd).getroproperty("title"),"Quality Center")
' If it doesn't or the title bar is empty, close the window
If (sCompare=0) or (IsNull(sCompare)) then
Window("hwnd:=" &vHwnd).Close
End If
Next
End Sub
No comments:
Post a Comment