Carson Reinke's (🚗☀☔🔑) Blog

Saving A Screenshot With A Headless Browser

  1. Install phantomjs with the following: brew install phantomjs
  2. Run the phantomjs webdriver: phantomjs --webdriver=8910
  3. Install the selenium-webdriver gem: gem install selenium-webdriver
  4. Create a driver and grab a screenshot: driver = Selenium::WebDriver.for(:remote, :url => "http://localhost:8910")driver.navigate.to "http://www.reinke.co"driver.save_screenshot('reinke.co.png')
phantomjs - selenium - ruby - webdriver