Skip to content

Commit

Permalink
Merge branch 'use_natural_dimensions' of git://github.com/HubTran/wat…
Browse files Browse the repository at this point in the history
…ir-get-image-content into HubTran-use_natural_dimensions
  • Loading branch information
a0o committed Jun 18, 2018
2 parents 8559800 + ee1c318 commit f3ae270
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/watir-get-image-content/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ class Image
def to_x_base64(target)
assert_exists
js = %Q{var canvas = document.createElement("canvas");
canvas.width = arguments[0].width;
canvas.height = arguments[0].height;
canvas.width = arguments[1];
canvas.height = arguments[2];
var ctx = canvas.getContext("2d");
ctx.drawImage(arguments[0], 0, 0);
var dataURL = canvas.toDataURL("image/#{target}");
return dataURL.replace(/^data:image\\/(png|jpg|gif);base64,/, "");}
driver.execute_script js, @element
driver.execute_script js, @element, natural_width, natural_height
end

def to_png_base64
Expand Down

0 comments on commit f3ae270

Please sign in to comment.