Menu

#235 Dialog handler

Version_2.0_beta1
open
9
2012-09-15
2010-12-17
Anonymous
No

I have the following code that works fine on other OS. Currently shifted to win 7 and IE 8 ..and this confirm handler no longer works. Just times out after a while without clicking the button and hangs the page.

    If (_internetExplorer.Button(Find.ById("Cancel")).Exists) Then
        'Cancel the class 
        _internetExplorer.AddDialogHandler(cdhPopup)
        _internetExplorer.Button(Find.ById("Cancel")).ClickNoWait() 'Find button using Regex to filter out extra ID elements from containers
        'cdhPopup.WaitUntilExists() 'Wait max of 5 seconds for the confirm box to pop up
        System.Threading.Thread.Sleep(5000)
        'Assert.IsTrue(_internetExplorer.ContainsText("Message from webpage"))
        Assert.IsTrue(cdhPopup.Message.Contains("Are you sure you want to cancel the class?"), "Dialog did not contain message expected.")
        cdhPopup.OKButton.Click() 'Press OK
        _internetExplorer.WaitForComplete() 'Wait for page to finish loading
    Else
        Assert.Fail("Could not found the Cancel Button")
    End If

Any idea how to resolve this problem,. Is it supported in win 7. Currently using WatiN-2.0.2.790-net-2.0

Discussion


Log in to post a comment.