Menu

#72 FireEventNoWait hangs when ModalWindow opened

Version_1.3.0
closed
5
2012-09-15
2008-04-02
Anonymous
No

Thanks for your very good library!

I have one problem with FireEventNoWait method, below is the code snippet to reproduce it:

// Work with popup.html from WatiN regression tests
IE ie = new IE("...watin\tests\popup.html")
ie.Button(Find.ById("modalid")).FireEventNoWait("onclick")

Last statement hangs until modal mindow is closed. This makes impossible to access modal windows which are opened by other events like "onMouseUp" (my case).

I've also tried to run it in separate thread, it works for me, but when I close dialog programmatically (Button.Click), I get an Exception:

IronPython Stack Trace:
File , line 0, in <stdin>##751
File , line 0, in Click##752
File WatiN.Core, line unknown, in Click
File WatiN.Core, line unknown, in WaitForComplete
File WatiN.Core, line unknown, in WaitForComplete
File WatiN.Core, line unknown, in WaitForComplete
File WatiN.Core, line unknown, in DoWait
File WatiN.Core, line unknown, in WaitForCompleteOrTimeout
File WatiN.Core, line unknown, in WaitWhileDocumentStateNotComplete
File Microsoft.mshtml, line unknown, in get_readyState
SystemError: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

On the other hand Button.ClickNoWait() hangs when I try to use it.

Version 1.2.1
Environment: IronPython, .Net 2.0
Internet Explorer 6

Discussion

  • Jeroen van Menen

    Logged In: YES
    user_id=799177
    Originator: NO

    Thanks for the report. I can reproduce the problem. The code seems to hang
    when WatiN is firing the onclick event on using javascript
    injection. The code that is injected is

    var newEvt = document.createEventObject();newEvt.button = 1;document.getElementById('ms__id2').fireEvent('onclick', newEvt);.

    calling the onclick where a dialog will show up should be done asynchronous to avoid the injected javascript is waiting for the result of the onclick. Maybe using a timer in javascript to call a function that calls FireEvent will do the trick.

    I'll need to give this some thought.

     
  • Jeroen van Menen

    Logged In: YES
    user_id=799177
    Originator: NO

    Thanks for the report. I can reproduce the problem. The code seems to hang
    when WatiN is firing the onclick event on using javascript
    injection. The code that is injected is

    var newEvt = document.createEventObject();newEvt.button = 1;document.getElementById('ms__id2').fireEvent('onclick', newEvt);.

    calling the onclick where a dialog will show up should be done asynchronous to avoid the injected javascript is waiting for the result of the onclick. Maybe using a timer in javascript to call a function that calls FireEvent will do the trick.

    I'll need to give this some thought.

     
  • Jeroen van Menen

    Logged In: YES
    user_id=799177
    Originator: NO

    Bug is fixed, FireEventNoWait didn't run the command asynchronous against the browser. Fix is available in the current development code on SourceForge and will be part of the 1.3 release.

    Thanks for the report!

     

Log in to post a comment.