TestComplete – Handling Web Browser (2)

Posted by Albert Gareev on Oct 14, 2010 | Categories: Source codeWeb

Parent page: GUI Recognition with TestComplete

Close all browser windows


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.


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 

    If IEProcess.Exists then
    End if 

End Function

  • One response to "TestComplete – Handling Web Browser (2)"

  • qagrl
    18th October 2010 at 5:37

    Please post more TestComplete tips like that

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.