watir-extensions-element-screenshot
watir-extensions-element-screenshot copied to clipboard
Error on taking screenshot on Firefox 85.0.1
Hi,
at first thanks for your good work! I use watir 6.14.0 with your extension (watir-extensions-element-screenshot (0.0.3) on Firefox 85.0.1 with geckodriver 0.29.0.
Here my sinple code:
require "rubygems"
require "watir"
require "watir/extensions/element/screenshot"
browser = Watir::Browser.new :firefox
browser.goto 'http://watir.com/'
browser.div(:class => 'logo').link().screenshot('screenshot.png')
browser.close
This produce the following error:
Traceback (most recent call last):
3: from test_firefox_ubuntu.rb:10:in `<main>'
2: from /var/lib/gems/2.6.0/gems/watir-extensions-element-screenshot-0.0.3/lib/watir/extensions/element/screenshot.rb:11:in `screenshot'
1: from /var/lib/gems/2.6.0/gems/chunky_png-1.4.0/lib/chunky_png/canvas/operations.rb:192:in `crop!'
/var/lib/gems/2.6.0/gems/chunky_png-1.4.0/lib/chunky_png/canvas.rb:312:in `replace_canvas!': The provided pixel array should have 13928.999633789062 items (ArgumentError)
Can you help? Thanks a lot!
I found a simple solution, just cast the parameter to integer:
image.crop!(wd.location.x.to_i + 1, wd.location.y.to_i + 1, wd.size.width.to_i, wd.size.height.to_i)