[
http://jira.openqa.org/browse/WTR-462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19996#action_19996
]
Alan Baird commented on WTR-462:
--------------------------------
If _new_window_init is supposed to be a private method, then why isn't it
explicitly private like Watir::IE#create_browser_window?
And, if it's intended to be private, why? If you do Watir::IE.new, and then
#close, you have effectively killed that instance of Watir::IE (assuming it
closes correctly) since it can't be legitimately restarted without calling
_new_window_init. You can call new again, but that defeats my purpose in
trying to restart IE without invalidating the instance of Watir::IE.
Maybe there is a really good reason for this that I am unaware of, but I'd like
to know what it is, as it would give me a legitimate reason to tell people
never to subclass Watir.
> Watir::IE#close doesn't set @closing variable to false after closing IE
> -----------------------------------------------------------------------
>
> Key: WTR-462
> URL: http://jira.openqa.org/browse/WTR-462
> Project: Watir
> Issue Type: Bug
> Components: Other
> Affects Versions: 1.6.7
> Environment: WIN XP, IE7
> Reporter: Alan Baird
> Priority: Major
>
> All -
> Consider the following example where I am trying to restart a browser using
> Watir's instance methods:
> irb(main):001:0> require 'watir'
> => true
> irb(main):002:0> br = Watir::IE.new
> => #<Watir::IE:0x2e384a4 url="about:blank" title=""> irb(main):003:0> br.goto
> 'google.com'
> => 1.641
> irb(main):004:0> br.close
> => nil
> irb(main):005:0> br._new_window_init
> => 0.422
> irb(main):006:0> br.goto 'google.com'
> => 0.859
> irb(main):007:0> br.close
> => nil
> This actually works just fine until the last line where the browser doesn't
> close (but the first br.close does close the browser).
> So, I examined the close method:
> # Closes the Browser
> def close
> return unless exists?
> @closing = true
> @ie.stop
> wait rescue nil
> chwnd = @ie.hwnd.to_i
> @ie.quit
> while Win32API.new("user32","IsWindow", 'L', 'L').Call(chwnd) == 1
> sleep 0.3
> end
> end
> Note that @closing is never set to false. Thus, whenever close is called
> subsequently, it will return immediately because the first thing #exists?
> does is:
> return false if @closing
> The fix is simple, just add @closing = false to the end of #close. I tested
> this in a monkeypatched version and it fixes the problem as I recreated it in
> IRB above.
--
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
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development