# Watir Javascript popup handler: How to handle the popup dial

**URL:** <https://www.ruby-forum.com/t/watir-javascript-popup-handler-how-to-handle-the-popup-dial/110809>\
**Category:** Ruby\
**Created:** [July 31, 2007, 6:40am UTC](https://www.ruby-forum.com/t/watir-javascript-popup-handler-how-to-handle-the-popup-dial/110809 "2007-07-31T06:40:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@rajesh](https://www.ruby-forum.com/u/rajesh)\
**Post date:** [July 31, 2007, 6:40am UTC](https://www.ruby-forum.com/t/watir-javascript-popup-handler-how-to-handle-the-popup-dial/110809/1 "2007-07-31T06:40:33Z")

</div>

Clarification regarding JSpopup\_dialog. Winclicker supports the popup  
when clicked on the link but the same fails in the second case. I  
think Watir is unable to get the handle of the dialog…Any help???  
Application hangs…

require ‘watir’

@ie = Watir::IE.new  
@ie.goto(“C:/test.html”)  
@ie.button(:caption, “Click this button”).click

I see that the application hangs up. How do i handle the dialog?  
I need to validate the ‘message’ and then click on ‘OK’

I tried the methods in WinClicker.rb but could not succeed. It just  
works fine when i do a click\_no\_wait but that doesn’t serve my  
purpose.  
Any suggestions/solution would be greatly appreciated.

Thanks in advance,  
– Rajesh.V

## My Application:
Page created for Testing
# Automation Testing

This works fine with the existing WinClicker.rb:  
Click this link

* * *

But this doesn't work !!!

* * *

\<a

---

<div class="post-metadata">

**Author:** ![rajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@rajesh](https://www.ruby-forum.com/u/rajesh)\
**Post date:** [August 6, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/watir-javascript-popup-handler-how-to-handle-the-popup-dial/110809/2 "2007-08-06T20:51:11Z")

</div>

Rajesh,  
There is some good info here in the FAQ about js popups:  
[http://wiki.openqa.org/display/WTR/FAQ](http://wiki.openqa.org/display/WTR/FAQ)

Also, just a note: keep in mind that doing a “click” in watir equates to  
a  
click and wait. therefore your current thread is waiting for IE to come  
back. Hope this helps, and if you need more help, please post your  
“popup  
handling” code. It will help to diagnose your problems.

/Shawn
