Skip to content

Instantly share code, notes, and snippets.

@pibby
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pibby/9421062 to your computer and use it in GitHub Desktop.
Save pibby/9421062 to your computer and use it in GitHub Desktop.
Using selenium, take screenshots in Safari of a responsive website running on a local python simple server at different breakpoints
#!/usr/bin/ruby
# Katie Harron - @pibby
require 'selenium-webdriver'
mq = [320,480,640,768,1024,1280,1440]
driver = Selenium::WebDriver.for :safari
driver.get 'http://localhost:8000'
mq.each do |i|
width = i + 15
height = 5000
puts i
driver.manage.window.resize_to(width, height)
sleep 3
driver.save_screenshot("screenshots/sf-#{i}.png")
end
driver.quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment