How to convert HTML to a base64 image with Selenium and Ruby
The most popular way to do it is with the Grover gem. Grover is a wrapper around Selenium that makes it easy to generate images from HTML.
Install Selenium Webdrivers for Ruby
gem install webdrivers
Get the base64 encoded image of some HTML
require 'webdrivers'
driver = Selenium::WebDriver.for :chrome
driver.get "https://www.bbc.co.uk/news/business-63709754"
@image = driver.screenshot_as(:base64)
puts @image