# Need ruby code to handle popup messages

**URL:** <https://www.ruby-forum.com/t/need-ruby-code-to-handle-popup-messages/174905>\
**Category:** Ruby\
**Created:** [September 3, 2009, 8:57pm UTC](https://www.ruby-forum.com/t/need-ruby-code-to-handle-popup-messages/174905 "2009-09-03T20:57:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@ravikanth](https://www.ruby-forum.com/u/ravikanth)\
**Post date:** [September 3, 2009, 8:57pm UTC](https://www.ruby-forum.com/t/need-ruby-code-to-handle-popup-messages/174905/1 "2009-09-03T20:57:18Z")

</div>

Hello guys

I am running an web application driven by watir  
in the webpage when i click the logout button the page should exit but  
the problem is a pop window comes stating “are you sure “yes or no””  
I need some help how to access this window and force it to yes and close  
automatically.

thanx in advance

---

<div class="post-metadata">

**Author:** ![ravikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@ravikanth](https://www.ruby-forum.com/u/ravikanth)\
**Post date:** [September 3, 2009, 9:15pm UTC](https://www.ruby-forum.com/t/need-ruby-code-to-handle-popup-messages/174905/2 "2009-09-03T21:15:49Z")

</div>

Ravi K. wrote:

> Hello guys
> 
> I am running an web application driven by watir  
> in the webpage when i click the logout button the page should exit but  
> the problem is a pop window comes stating “are you sure “yes or no””  
> I need some help how to access this window and force it to yes and close  
> automatically.
> 
> thanx in advance

You have many options:  
2 of them →   
1- SendKeys -

> **[Automating Applications with Ruby & The Windows Script Host](http://rubyonwindows.blogspot.com/2007/05/automating-applications-with-ruby.html)**
>
> We've talked at length about automating Windows applications through COM/OLE, using the win32ole library. But not all applications expose t...

2- check this example and modify the wait() method according your  
window title [http://wiki.openqa.org/display/WTR/Security+Alerts](http://wiki.openqa.org/display/WTR/Security+Alerts)

-ronnie.

---

<div class="post-metadata">

**Author:** ![ravikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@ravikanth](https://www.ruby-forum.com/u/ravikanth)\
**Post date:** [September 3, 2009, 9:37pm UTC](https://www.ruby-forum.com/t/need-ruby-code-to-handle-popup-messages/174905/3 "2009-09-03T21:37:40Z")

</div>

thanx a lot  
it helped a lot
