0.0
No commit activity in last 3 years
No release in over 3 years
Generate visual diff by chrome.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
< 4.0

Runtime

< 1.0
 Project Readme

ChromeDiff

Gem Version

Visual diff tool powered by headless chrome.

This tool controls Chrome by Chrome DevTools Protocol based on Ferrum.

Installation

$ gem install chrome_diff

Requirements

  • Google Chrome (or Chromium)
  • ImageMagick

Usage

Command-line

$ chrome-diff -f "https://google.com/?q=hello" -t "https://google.com/?q=world"
There are some diffefences (1.44%): diff.png

Options

Usage: chrome-diff [options]
    -f, --from-url [FROM_URL]        From url
    -t, --to-url [TO_URL]            To url
    -o, --output [OUTPUT]            Output file
    -w, --width [WIDTH]              Window width (default 800)
    -h, --height [HEIGHT]            Window height (default 600)
    -q, --quiet                      Quiet mode
        --threshold [THRESHOLD]      Threshold percent (default 1%)
        --debug                      Debug mode (default false)
        --no-output                  Don't output diff file
        --full-screenshot            Capture full screenshot

As library

session = ChromeDiff::Session.new
session.compare("https://example.com/", "https://www.google.com/")

Customize

session = ChromeDiff::Session.new(width: 800, height: 600, timeout: 5, debug: false)
session.compare(from_url: from_url, to_url: to_url, output: "diff.png", threshold: 1, full_screenshot: false)
  • width: window width (default 800px)
  • height: window height (default 600px)
  • timeout: browser timeout (default 5 seconds)
  • debug: debug mode (default false)
  • from_url: from url (required)
  • to_url: to url (required)
  • output: output diff image (default diff.png)
  • threshold: threshold percent (default 1%)
  • full_screenshot: take full screenshot (default false)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hogelog/chrome_diff.

License

The gem is available as open source under the terms of the MIT License.