views:

346

answers:

3

System: Window 7 Internet Explorer 8 Ruby 1.8 Watir 1.6.5

If I manually open a browser window and then visit a site that causes a second browser window to open and then use the Watir::IE.attach method to find the second browser window everything work fine. The problem is when I open the first Internet Explorer window with the command Watir::IE.new and then visit a site that causes a second browser window to open. When I use Watir::IE.attach to find the second browser window I now get: Watir::Exception::NoMatchingWindowFoundException: Unable to location a window with title of (?-mix:x) from /ie-class.rb:297:in 'attach_browser_window' from /ie-class.rb:149:in '_attach_init' from /ie-class.rb:143:in 'attach' from (irb):15

Has anyone run into this problem and developed a solution?

I have done a little more investigating and I am running my script with administrative rights, and it is opening IE8 as administrator and then trying to open a new window. I tried to open IE8 as administrator manually and then open a new window from the browser then run the attach command with watir and I did get the same error as if I created the initial window with watir.

I do want to be able to run my script as administrator.

I have tried executing the watir command manually and also running in a script:

======================

require 'rubygems'

require 'watir'

ie = Watir::IE.start("http://www.quackit.com/html/codes/html_open_link_in_new_window.cfm")

ie.link(:text,"HTML Help").click

ie2 = Watir::IE.attach(:title,/Help/)

======================

+1  A: 

Right now watir assumes that the window you want to attach to is called "Internet Explorer". I think the name of the IE8 might be different from this. You can change this on line 238 of ie-class.rb.

Bret

Bret Pettichord
I took look at the windows that the WIN32OLE.new(Shell.Application).windows were getting in the ie-class.rb, and the new popup window was not listed at all.
Zachary Hayes
My suggestion is incorrect. I tried to down vote it, but I'm not allowed to vote for my own post.
Bret Pettichord
@Bret: Leaving a comment (like you did) should be enough information for readers in the future.
Željko Filipin
A: 

I have the same problem. I can't open form builder in IE 8. Is it depends on this script?

A: 

I think this link might be the solution to this problem http://watirboy.blogspot.com/2010/07/watir-timeout-handle-browser-hangstuck.html

jovi