Thanks for the patch! Even though the contribution is appreciated, I'm going to 
vote against accepting it. 

Anyone who has a use case already have two options:

* grab the image using `Image#src` and an HTTP client
* use `#execute_script` themselves

So adding it to watir-webdriver is just for convenience, and as proposed it 
won't even solve every case - only if the image is `image/png`.

I also think it's a bad idea in general to start accepting inline JS and 
`execute_script` wrappers in the code base. It makes us a lot more likely to 
have cross-browser bugs (e.g., will `to_png_base64` work in all versions of 
IE?) If someone wants to maintain this, it can easily be added in an extension 
gem, maybe with an API like this:

```ruby
require 'watir-webdriver'
require 'watir-webdriver-image-content'

browser = Watir::Browser.start('http://...')
image = browser.image(id: 'foo')

ImageContent.from(image).content_type('image/png').as(:base64) #=> "..."
```


---
Reply to this email directly or view it on GitHub:
https://github.com/watir/watir-webdriver/pull/239#issuecomment-33677142
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to