Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
elcamino / full-page-screenshots-selenium-chrome.rb
Last active Sep 7, 2020
How to take full-page screenshots with Selenium and Google Chrome in Ruby
View full-page-screenshots-selenium-chrome.rb
#!/usr/bin/env ruby
require 'selenium-webdriver'
wd = Selenium::WebDriver.for :remote, url: '', desired_capabilities: :chrome ''
# Get the actual page dimensions using javascript
width = wd.execute_script("return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);")
You can’t perform that action at this time.