Last active
August 29, 2015 13:57
-
-
Save pibby/9420993 to your computer and use it in GitHub Desktop.
Using watir-webdriver, take screenshots in Firefox of a responsive website entered by the user at different breakpoints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Katie Harron - @pibby | |
# Use Firefox to take screen captures of a responsive website at multiple breakpoints, ask the user to input the URL | |
require 'watir-webdriver' | |
puts "Enter URL to capture: " | |
site = gets.chomp() | |
mq = [320,480,640,768,1024,1280,1440] | |
b = Watir::Browser.new :firefox | |
b.goto site | |
mq.each do |i| | |
width = i + 15 | |
height = 5000 | |
puts i | |
b.window.resize_to(width, height) | |
sleep 3 | |
b.screenshot.save "FF_#{site}-#{i}.png" | |
end | |
b.quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment