0

I hve a web app that can open several windows, not new browser windows, but windows overlapping the main window, like pop up windows. At one place I have to verify if I am on the main app window. My first idea was to get the number of windows in a browser and if this is 0 then I am home, but I cannot find a solution to how to count those objects.

Main page looks like this :

Browser().Page()

If I open a new window (popup) it looks like this :

Browser().Window().Page()

And if I open another from the previous one it looks like this :

Browser().Window().Window().Page()

The question is how can I get the number of Window elements?

tom
  • 1,223
  • 6
  • 16
  • 26

1 Answers1

0

The opened windows were popup windows, so I wrote a function that waits until there are no popups. Probably a bit too complicated, but works.

Function waitForNoWindows(ByVal vSeconds)
   blnDone = False
   counter = 1
   While Not blnDone
       Wait 1
       If objBrowser.Window("ispopupwindow:=true").Exist(0) Then
           blnDone = False
        Else
            blnDone = True
       End If
       counter = counter + 1
       If counter = vSeconds Then
           blnDone = True
           reporter.ReportEvent micFail, "Waiting for all pop up windows to close", "Canot close all pop up windows and/or timeout reached"
           ExitTestIteration
       End If
   Wend
End Function
tom
  • 1,223
  • 6
  • 16
  • 26