Skip to content

Instantly share code, notes, and snippets.

@jurgenwerk
Created May 13, 2014 21:26
Show Gist options
  • Save jurgenwerk/13f2b9c42dd1c70e3828 to your computer and use it in GitHub Desktop.
Save jurgenwerk/13f2b9c42dd1c70e3828 to your computer and use it in GitHub Desktop.
Taking Screenshots with Capybara and Webkit
require 'capybara'
require 'capybara/dsl'
Capybara.current_driver = :webkit
module Screenshot
class Test
include Capybara::DSL
def take_screenshot(url)
visit(url)
page.save_screenshot("screenshot.png")
end
end
end
Screenshot::Test.new.take_screenshot("http://pornhub.com")
@jurgenwerk
Copy link
Author

don't forget capybara and capybara-webkit gems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment