# Winclicker is not clicking the button on pop-up window

**URL:** <https://www.ruby-forum.com/t/winclicker-is-not-clicking-the-button-on-pop-up-window/126618>\
**Category:** Ruby\
**Created:** [January 20, 2008, 2:24pm UTC](https://www.ruby-forum.com/t/winclicker-is-not-clicking-the-button-on-pop-up-window/126618 "2008-01-20T14:24:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhavesh1\_sharma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/dfb087/32.png) [@bhavesh1\_sharma](https://www.ruby-forum.com/u/bhavesh1_sharma)\
**Post date:** [January 20, 2008, 2:24pm UTC](https://www.ruby-forum.com/t/winclicker-is-not-clicking-the-button-on-pop-up-window/126618/1 "2008-01-20T14:24:16Z")

</div>

Hi,

I have to create an script where i have to open an page in IE7.

Once page is opened, i have to click the “Delete” button.

As soon as i press the “Delete” button, an Windows Internet explorer  
window [small window] pop up with options “Ok” and “Cancel”.

But using watir code im not able to click “Ok” button.

I have tried writing code like this –

def jsAlert(button, waitTime = 3)  
w = WinClicker.new  
longName = $ie.dir.gsub("/" , “\” )  
shortName = w.getShortFileName(longName)  
c = "start ruby #{shortName}\watir\clickJSDialog.rb #{button}  
#{waitTime} "  
puts “Starting #{c}”  
w.winsystem©  
w=nil  
end

Then, before the button i want to click that generates the popup, added:

jsAlert(“OK”, 3)

ie.button(:name, “Delete”).click #After clicking this delete button, a  
pop-up window comes up where i need to click “OK” button.

This pop-up window is an modal window i mean im not able to select  
anything behind this window and it is having a title of “Windows  
Internet Explorer”

I have defined the fuctions sAlert and then immedaitely called it. It  
starts another DOS window and searc hsomething but bydefault after 30  
secs this Dos window gets closed.

---

<div class="post-metadata">

**Author:** ![bhavesh1\_sharma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/dfb087/32.png) [@bhavesh1\_sharma](https://www.ruby-forum.com/u/bhavesh1_sharma)\
**Post date:** [January 20, 2008, 4:38pm UTC](https://www.ruby-forum.com/t/winclicker-is-not-clicking-the-button-on-pop-up-window/126618/2 "2008-01-20T16:38:45Z")

</div>

Dear Bhavesh,

> I have to create an script where i have to open an page in IE7.

I am not a watir expert, but I had positive experience with Windows  
Automation using AutoIT :

> **[AutoIt Scripting Language - AutoIt](https://www.autoitscript.com/site/autoit/)**
>
> AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI and general purpose scripting.

Best regards,

Axel
