ansoni / watir-extensions-element-screenshot

Element Screenshot Support for watir
Apache License 2.0
22 stars 12 forks source link

Image not properly cropping when wd passes float values #2

Closed Liiva closed 8 years ago

Liiva commented 10 years ago

I was getting weird behaviour while trying to capture some screenshots.

It turned out the WebDriver element was returning a float value: wd x location: 362 wd y location: 202.5 <-- issue here wd size width: 940 wd size height: 562

Changing line #11 in https://github.com/ansoni/watir-extensions-element-screenshot/blob/master/lib/watir/extensions/element/screenshot.rb to: image.crop!((wd.location.x + 1).round, (wd.location.y + 1).round, wd.size.width, wd.size.height) Fixed it for me.