Hello,
I'm trying to manipulate modal_dialog and I have an issue.
In Watir (Ruby) code, I create two threads. One is to load the target page and
click on a button. The button in the target page has onclick event handler that
executes JavaScript to show modal popup. The other thread in Ruby watches for
modal_dialog. The main thread before branching looks like the following.
def test
$ie = IE.new
m = ModalWindowHandler.new
modalWindowHandlerThread = Thread.new {
m.handleWindow()
}
l = Thread.new{loadPage()}
modalWindowHandlerThread.join
l.join
end
Here is the first thread code.
def loadPage()
$ie.goto('http://localhost/Default.htm')
loadButton = $ie.button(:name, 'btnLoad')
loadButton.click
end
So the first thread loads the modal window, and the other thread watches for it
and when it finds it, it clicks on the close button. However, when the first
Ruby thread clicks on the button that invokes JavaScript to show modal window,
the other thread (modalWindowHandlerThread) also stops. This causes the entire
Watir script to halt. But when I manually close the popup window and manually
click on the button to show the modal popup window, the other thread restarts
and successfully finds the modal window.
Does anyone know how to resolve this issue? Please let me know.
TIA
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general