Skip to content

Instantly share code, notes, and snippets.

Avatar

elcamino

View GitHub Profile
@elcamino
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: 'http://10.3.1.7:4444/wd/hub', desired_capabilities: :chrome
wd.navigate.to 'https://snipt.net/restrada/python-selenium-workaround-for-full-page-screenshot-using-chromedriver-2x/'
# 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.