Screenshot of a particular element with Ruby and Selenium

Install Selenium Webdrivers for Ruby

gem install webdrivers

Take a screenshot of the element and save to file

require 'webdrivers'

driver = Selenium::WebDriver.for :chrome

driver.get ""

element = driver.find_element(css: '.ssrcss-hmf8ql-BoldText')


Find out how to take a full-page screenshot with Ruby and Selenium.

We created Urlbox to make converting HTML to images easy

Learn more about our website screenshot API.