Screenshot the viewport with Ruby and Selenium
Install Selenium Webdrivers for Ruby
gem install webdrivers
Take a screenshot of the viewport and save to file
require 'webdrivers' driver = Selenium::WebDriver.for :chrome driver.get "https://www.bbc.co.uk/news/business-63709754" driver.save_screenshot("./viewport.png")
Find out how to change the size of the viewport with Ruby and Selenium.
We created Urlbox to make converting HTML to images easy
Learn more about our website screenshot API.