# Clicking on popup after selecting an item in select list

**URL:** <https://rubytalk.org/t/clicking-on-popup-after-selecting-an-item-in-select-list/33889>\
**Category:** ruby-talk\
**Created:** [20 December 2006 03:53 UTC](https://rubytalk.org/t/clicking-on-popup-after-selecting-an-item-in-select-list/33889 "2006-12-20T03:53:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikash\_Kumar](https://avatars.discourse-cdn.com/v4/letter/v/90ced4/32.png) [@Vikash\_Kumar](https://rubytalk.org/u/Vikash_Kumar)\
**Post date:** [20 December 2006 03:53 UTC](https://rubytalk.org/t/clicking-on-popup-after-selecting-an-item-in-select-list/33889/1 "2006-12-20T03:53:27Z")

</div>

I am getting a javascript pop up after I select a value from some drop  
down list using the select\_list method. Since I can not use  
click\_no\_wait for a list, how am I supposed to handle the pop up.

Can anyone please provide a solution for it.

I am using the following code to assess a select list, I am using Watir  
Version 1.5.1.1100

The code is as follows :

require 'watir' # the watir controller  
require 'watir/winClicker.rb'  
require 'watir\contrib\enabled\_popup'  
require 'Enter\_on\_inputbox'

enter\_on\_inputboxObj = Enter\_on\_inputbox.new

instance = "c:\\aa.htm"  
ie=Watir::IE.start(instance)

#THIS PART IS WORKING, using click\_no\_wait  
ie.image(:index,'4').click\_no\_wait  
enter\_on\_inputboxObj.startClicker(ie, $hwnd, "OK", 7, "Good")

> **···**
>
> ###############################
> 
> ie.select\_list(:name, "trx").select("First")
> 
> # Here too a javascript box is coming, but I am unable to click on the  
> OK button
> 
> I have defined a class name Enter\_on\_inputbox
> 
> require 'watir/winClicker.rb'  
> class Enter\_on\_inputbox  
> &nbsp;&nbsp;&nbsp;&nbsp;def initialize  
> &nbsp;&nbsp;&nbsp;&nbsp;end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def startClicker( ie, hwnd, button , waitTime, user\_input)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hwnd = ie.enabled\_popup(waitTime) # get a handle if one exists  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;w = WinClicker.new  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (hwnd) # yes there is a popup  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;w = WinClicker.new  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( user\_input )  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(user\_input)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$stdout.flush  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;w.setTextValueForFileNameField(hwnd, "#{user\_input}")
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep 3 # I put this in to see the text being input it  
> is not necessary to work
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;w.clickWindowsButton\_hwnd(hwnd, "#{button}") # "OK" or  
> whatever the name on the button is  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;w=nil # this is just cleanup  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
> &nbsp;&nbsp;&nbsp;&nbsp;end  
> end
> 
> After it select the value from list, a javascript pop up comes asking  
> for OK or Cancel, here my code get stops until I click manually on OK or  
> Cancel Button, please help me out from this.
> 
> Thanks in advance  
> Vikash
> 
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Vikash\_Kumar](https://avatars.discourse-cdn.com/v4/letter/v/90ced4/32.png) [@Vikash\_Kumar](https://rubytalk.org/u/Vikash_Kumar)\
**Post date:** [20 December 2006 05:52 UTC](https://rubytalk.org/t/clicking-on-popup-after-selecting-an-item-in-select-list/33889/2 "2006-12-20T05:52:11Z")

</div>

Vikash Kumar wrote:

> I am getting a javascript pop up after I select a value from some drop  
> down list using the select\_list method. Since I can not use  
> click\_no\_wait for a list, how am I supposed to handle the pop up.
> 
> Can anyone please provide a solution for it.

> Thanks in advance  
> Vikash

I am using a test case in ruby, watir and a html page, but I am stuck  
when I select values from select list, as javascript popup comes up.  
Please provide a solution for this. Any help will be appreciated.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Alex\_Young](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Alex\_Young](https://rubytalk.org/u/Alex_Young)\
**Post date:** [20 December 2006 08:39 UTC](https://rubytalk.org/t/clicking-on-popup-after-selecting-an-item-in-select-list/33889/3 "2006-12-20T08:39:22Z")

</div>

Vikash Kumar wrote:

> Vikash Kumar wrote:
> 
> > I am getting a javascript pop up after I select a value from some drop  
> > down list using the select\_list method. Since I can not use  
> > click\_no\_wait for a list, how am I supposed to handle the pop up.
> > 
> > Can anyone please provide a solution for it.
> 
> > Thanks in advance  
> > Vikash
> 
> I am using a test case in ruby, watir and a html page, but I am stuck when I select values from select list, as javascript popup comes up. Please provide a solution for this. Any help will be appreciated.

You may wish to ask on the watir list. Alternatively, [watir javascript popup - Google Search](http://www.google.co.uk/search?q=watir+javascript+popup) will probably give you what you want.

> **···**
>
> --  
> Alex
