Internet Explrer Automation vs Modal Windows

  • Thread starter Daniel Flippance
  • Start date
D

Daniel Flippance

We are trying to write some NUnit tests to automate our web application and
have been pretty successful so far, basing our code on Dave Chaplin's
example:
http://www.byte-vision.co.uk/aspAutomatingNUnitAndIE.asp

However, our application makes use of Modal windows from Internet Explorer.
ie: We use the window.showModalDialog function.

The problem is that when we call a button.click method, which calls the
above showModalDialog method, we can never get a reference to the new window
that is created, even if we do this on a separate thread.

If the new window is not modal, the following code works fine, but not if
it's modal. (index = the count of the windows prior to creating the new
window)

So Basically, how can we automate the new Modal window using the Internet
Explorer automation model?

============================================
Public Class IEDriver

....

Public Function WaitForWindow(ByVal index As Integer) As IEDriver
Dim wins As New ShellWindows()
Dim newIEDriver As IEDriver
Dim newIE As InternetExplorer

If wins.Count > 0 Then

'Wait for the new window to get created...
While wins.Item(index) Is Nothing
Thread.Sleep(100)
End While

If TypeOf wins.Item(index) Is InternetExplorer Then
newIE = CType(wins.Item(index), InternetExplorer)
End If

'Wait for the ready state...
While newIE.ReadyState <> tagREADYSTATE.READYSTATE_COMPLETE
Thread.Sleep(100)
End While

newIEDriver = New IEDriver(newIE)
End If

Return newIEDriver
End Function

....
End Class
============================================

Any thoughts or suggestions of directions to look in would be gratefully
accepted.

Thanks
Daniel Flippance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top