[ 
http://jira.openqa.org/browse/WTR-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20124#action_20124
 ] 

Charley Baker commented on WTR-463:
-----------------------------------

Is this issue closed or not? 

> close_all throws exception in Watir 1.6.7
> -----------------------------------------
>
>                 Key: WTR-463
>                 URL: http://jira.openqa.org/browse/WTR-463
>             Project: Watir
>          Issue Type: Bug
>          Components: Wait
>    Affects Versions: 1.6.7
>         Environment: Windows XP, IE7
>            Reporter: Alan Baird
>            Assignee: Jarmo Pertman
>            Priority: Critical
>             Fix For: Soon
>
>
> Watir::IE.close_all appears to be broken in 1.6.7 (it's possible it's broke 
> in 1.6.6 but I don't think this was changed in 1.6.6).  Consider the 
> following code.  I have addded a line in Watir::Exception.until_with_timeout 
> to record the timeout that is being passed to Wait.until in line 10 of 
> module.rb.  This clearly shows that 0 is being passed to Wait.until.  This 
> causes the unexpected Watir::Wait::TimeoutError.
> {code}
> N:\gauntlet>irb --noreadline
> irb(main):001:0> require 'watir'
> => true
> irb(main):002:0> br = Watir::IE.new
> => #<Watir::IE:0x4108a48 url="about:blank" title="">
> irb(main):003:0> br.close
> => false
> irb(main):004:0> br = Watir::IE.new
> => #<Watir::IE:0x40f6de8 url="about:blank" title="">
> irb(main):005:0> Watir::IE.close_all
> the attach timeout is 0
> Watir::Wait::TimeoutError: timed out after 0 seconds
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.7/lib/watir/wait.rb:23:in 
> `until'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/module.rb:11:in 
> `until_with_timeout'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/modal_dialog.rb:16:in 
> `find_modal_from_window'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/modal_dialog.rb:36:in 
> `locate'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/modal_dialog.rb:86:in 
> `initialize'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/container.rb:188:in `new'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/container.rb:188:in 
> `modal_dialog'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/close_all.rb:29:in 
> `close_modal'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/close_all.rb:16:in 
> `close_all_but'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/ie-class.rb:245:in `each'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/ie-class.rb:240:in `each'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/close_all.rb:15:in 
> `close_all_but'
>         from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/close_all.rb:7:in 
> `close_all'
>         from (irb):5
> irb(main):006:0> puts Watir::IE.attach_timeout
> 2.0
> => nil
> {code}
> The culprit, I believe, is Watir::IE#close_modal: 
> {code}
> # close modal dialog. unlike IE#modal_dialog.close, does not wait for dialog
> # to appear and does not raise exception if no window is found.
> # returns true if modal was found and close, otherwise false
> def close_modal
>   begin
>     original_attach_timeout = IE.attach_timeout
>     IE.attach_timeout = 0
>     self.modal_dialog.close
>     true
>   rescue NoMatchingWindowFoundException, TimeOutException
>     false
>   ensure
>     IE.attach_timeout = original_attach_timeout
>   end
> end
> {code}
> What's weird is that it specifically states in the comment that this should 
> not raise an exception but it clearly is.  The reason is that line 28 in 
> close_all.rb sets the IE.attach_timeout to 0.  I tried commenting out this 
> line but it still raises a Watir::Wait::TimeoutError.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Wtr-development mailing list
Wtr-development@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to