# Unable to handle a browser window

**URL:** <https://www.ruby-forum.com/t/unable-to-handle-a-browser-window/136778>\
**Category:** Ruby\
**Created:** [May 6, 2008, 11:36am UTC](https://www.ruby-forum.com/t/unable-to-handle-a-browser-window/136778 "2008-05-06T11:36:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pranjal\_jain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac91a4/32.png) [@pranjal\_jain](https://www.ruby-forum.com/u/pranjal_jain)\
**Post date:** [May 6, 2008, 11:36am UTC](https://www.ruby-forum.com/t/unable-to-handle-a-browser-window/136778/1 "2008-05-06T11:36:39Z")

</div>

Hi  
In one web site when i am clicking on the page, a new browser window  
is opening. But I cannot handle the window (i.e) I cannot the perform  
the operations like writing the data in it; clicking on the “Save  
Comments” button & closing the window.

I had written the code also:

require ‘rubygems’  
require ‘watir/watir\_simple.rb’  
require ‘test/unit’  
require ‘watir’  
include Watir

require ‘database’

# User defined library

require ‘popup’  
database()  
b = 0  
$ie = IE.new  
$ie.goto(“[https://tms.corp.xyz.com/](https://tms.corp.xyz.com/)”)  
$ie.bring\_to\_front  
$ie.maximize  
$ie.text\_field(:name,‘{actionForm.username}’).set($username[b].to\_s)  
$ie.text\_field(:name,‘{actionForm.password}’).set($password[b].to\_s)  
$ie.button(:name, ‘actionOverride:validateLogin.do’).click

if($ie.link(:href,“javascript:openWin(‘callCommentAction.do?projectID=39049&posreqID=3&projectName=Testing  
Practice&displayDate=Mon, 05-May-08 - Sun, 11-May-08( Week Number 19  
)&userName=Pranjal.Jain&index=0&comments=’,‘winAmend’,500,250)”).exists?)  
begin  
$ie.link(:href,“javascript:openWin(‘callCommentAction.do?projectID=39049&posreqID=3&projectName=Testing  
Practice&displayDate=Mon, 05-May-08 - Sun, 11-May-08( Week Number 19  
)&userName=abc.xyz&index=0&comments=’,‘winAmend’,500,250)”).click

startClicker( “Save Comments”, 15 , “Hello”) # function from popup  
script is cld  
end  
else  
puts “Sorry”  
end  
"

Here “startClicker” is the standard pop up handler function

Please suggest 🙂  
Thanks in advance
