At 12:15 PM 9/20/2005, Keith Kaminski wrote:
>I had been getting this error:
>
>WIN32OLERuntimeError: document
> OLE error code:80004005 in <Unknown>
> <No Description>
> HRESULT error code:0x80020009
> Exception occurred.
> c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1336:in `method_missing'
> c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1336:in `document'
> c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1652:in `focus'
This error will occur when the IE browser is empty. For example, this will
reproduce it:
ie.goto('about:blank')
ie.focus
>I decided to restart my machine and try again, and now I'm able to run
>my script without any errors. However, focus still isn't doing what I
>would expect. The focus remains on the command prompt even though it's
>called and executed.
>
>I did a little bit more experimenting and have discovered that this is
>only problem if I have an existing IE window open. If I close up all of
>my IE windows and then run my ruby scripts, everything is perfect. The
>focus automatically shifts from my command prompt to IE. If I open up my
>browser, head to google, and then run my ruby scripts from the command
>prompt... the focus remains on the command prompt.
>
>Anyone else have this issue?
I've heard reports like this and have seen some of this myself. I do see
somewhat different behavior if i run a script with an IE window already
open, instead of not. I also wonder if some of this variation is based on
OS (2000 vs XP, e.g.).
I wrote the following code to make sure extra IE windows were closed before
running Watir scripts:
count = 0
while true
begin
browser = Watir::IE.attach(:title, //)
browser.close
count += 1
rescue Watir::Exception::NoMatchingWindowFoundException
break
end
end
puts "#{count} windows closed"
_____________________
Bret Pettichord
www.pettichord.com
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general