Skip to content

Instantly share code, notes, and snippets.

@squiter
Created April 3, 2012 20:25
Show Gist options
  • Save squiter/2295269 to your computer and use it in GitHub Desktop.
Save squiter/2295269 to your computer and use it in GitHub Desktop.
Take a screenshot
# first install 'selenium-webdriver'gem
require 'selenium-webdriver'
width = 800
height = 600
driver = Selenium::WebDriver.for :firefox
driver.navigate.to 'http://localhost:3000'
driver.execute_script %Q{
window.resizeTo(#{width}, #{height});
}
driver.save_screenshot('/tmp/screenshot.png')
driver.quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment