2

I am using Watir with Ruby.

I need to save screenshots. but it is improper screenshot. Could you please help me out.

This is my code.

require 'watir'
browser = Watir::Browser.start 'www.google.com'
browser.maximize
browser.bring_to_front

browser.screenshot.save "C:/screenshot/jones.png"

Thanks in Advance !

1 Answers1

0

Following code segments did a proper screenshot in IE for me without using maximize and bring_to_front. You can try this:

require 'watir'
browser = Watir::Browser.new :ie
browser.goto 'www.google.com'

browser.screenshot.save "C:/screenshot/jones.png"

I am using following versions:

  • ruby 2.3.0
  • watir 6.2.1
  • Windows 8.1