I'm dumping screenshots of failed scenarios. Here is my current code:
# Take screenshot
if defined?(browser.driver)
browser.driver.save_screenshot(screenshot_filename + ".png")
elsif ENV["BROWSER"] == 'IE'
# Dump screenshot via Print Screen
browser.maximize
VK_SNAPSHOT = 0x2C
browser.send_keys(VK_SNAPSHOT)
word = WIN32OLE.new('Word.Application')
word.Documents.Add
word.Selection.Paste
word.ActiveDocument.SaveAs(screenshot_filename + ".doc")
word.ActiveDocument.Close
word.Quit
end
It used to work in IE with previous versions of Watir. Now, I'm getting
error inside send_keys():
undefined method `split' for 44:Fixnum (NoMethodError)
C:/Ruby/lib/ruby/gems/1.9.1/gems/rautomation-0.6.3/lib/rautomation/adapter/win_ffi/keystroke_converter.rb:9:in
`convert'
C:/Ruby/lib/ruby/gems/1.9.1/gems/rautomation-0.6.3/lib/rautomation/adapter/win_ffi/window.rb:118:in
`send_keys'
C:/Ruby/lib/ruby/gems/1.9.1/gems/rautomation-0.6.3/lib/rautomation/window.rb:184:in
`send_keys'
C:/Ruby/lib/ruby/gems/1.9.1/gems/watir-1.9.2/lib/watir/ie-class.rb:478:in
`send_keys'
M:/Users/DK/Projects/RAP/WorkingCopy/features/support/env.rb:147:in `After'
I tried both Ruby 1.8 and Ruby 1.9. In 1.8 I'm getting a slightly
different error:
private method `split' called for 44:Fixnum (NoMethodError)
C:/Ruby/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/adapter/win_ffi/keystroke_converter.rb:9:in
`convert'
C:/Ruby/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/adapter/win_ffi/window.rb:118:in
`send_keys'
C:/Ruby/lib/ruby/gems/1.8/gems/rautomation-0.6.3/lib/rautomation/window.rb:184:in
`send_keys'
C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.9.2/lib/watir/ie-class.rb:478:in
`send_keys'
M:/Users/DK/Projects/RAP/WorkingCopy/features/support/env.rb:147:in `After'
Is it a known problem?
--
DK
AIM: DKroot1, Skype: DKroot
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]