Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hogelog/chrome_diff
https://github.com/hogelog/chrome_diff
Last synced: 24 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hogelog/chrome_diff
- Owner: hogelog
- License: mit
- Created: 2019-05-11T14:00:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-01T16:16:26.000Z (about 4 years ago)
- Last Synced: 2024-12-12T00:25:17.061Z (about 1 month ago)
- Language: Ruby
- Size: 28.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ChromeDiff
[![Gem Version](https://badge.fury.io/rb/chrome_diff.svg)](https://badge.fury.io/rb/chrome_diff)Visual diff tool powered by headless chrome.
This tool controls Chrome by [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) based on [Ferrum](https://github.com/rubycdp/ferrum).
## Installation
```console
$ gem install chrome_diff
```## Requirements
- Google Chrome (or Chromium)
- ImageMagick## Usage
### Command-line
```console
$ chrome-diff -f "https://google.com/?q=hello" -t "https://google.com/?q=world"
There are some diffefences (1.44%): diff.png
```#### Options
```console
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
```ruby
session = ChromeDiff::Session.new
session.compare("https://example.com/", "https://www.google.com/")
```#### Customize
```ruby
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](https://opensource.org/licenses/MIT).