Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a0s/watir-get-image-content
Get Watir::Image's content copy without external download
https://github.com/a0s/watir-get-image-content
image plugin ruby watir webdriver
Last synced: 3 months ago
JSON representation
Get Watir::Image's content copy without external download
- Host: GitHub
- URL: https://github.com/a0s/watir-get-image-content
- Owner: a0s
- License: mit
- Created: 2014-01-30T12:34:47.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-11-28T17:10:36.000Z (about 4 years ago)
- Last Synced: 2024-10-31T13:55:28.003Z (3 months ago)
- Topics: image, plugin, ruby, watir, webdriver
- Language: Ruby
- Homepage:
- Size: 27.3 KB
- Stars: 13
- Watchers: 5
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Return content of image as base64-encoded png
[![Build Status](https://travis-ci.org/a0s/watir-get-image-content.png?branch=master)](https://travis-ci.org/a0s/watir-get-image-content)
## Installation
Add this line to your application's Gemfile:
gem 'watir-get-image-content'
And then execute:
$ bundle
Or install it yourself as:
$ gem install watir-get-image-content
## Usage
```ruby
require 'watir'
require 'watir-get-image-content'
browser = Watir::Browser.new
browser.goto 'http://for_example.com/page_with_images'browser.image(:index, 1).to_png_base64
browser.image(:alt, 'Alt text').to_png_base64
browser.image(:index, 1).to_jpg_base64
browser.image(:alt, 'Alt text').to_jpg_base64File.write('png.png', browser.image(:index, 1).to_png)
File.write('jpg.jpg', browser.image(:index, 1).to_jpg)
```## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request