TestComplete – Handling Web Browser (2)
Parent page: GUI Recognition with TestComplete
Close all browser windows
Description
In the example presented, Internet Explorer browser program (executable name) is hard-coded (as “iexplore”).
Closing begins from first instance number (i.e. a sequential number of the process in memory, if a few were loaded).
In first attempt, .Close method is used, which allows an application to finalize.
Second attempt uses .Terminate method. Any unsaved data will be lost.
Implementation
Public Const syncTimeShort = 5 ' Public Function wbCloseAll() Dim IEProcess Dim PropNames, PropValues While True PropNames = Array("processname", "index") PropValues = Array("iexplore", 1) Set IEProcess = Sys.FindChild(PropNames, PropValues, 1, True) If Not IEProcess.Exists then Exit Function End if IEProcess.Close(syncTimeShort*1000) If IEProcess.Exists then IEProcess.Terminate End if WEnd End Function
One response to "TestComplete – Handling Web Browser (2)"
Please post more TestComplete tips like that