Method: Watir::Image#save

Defined in:
lib/watir-classic/image.rb

#save(path) ⇒ Object

TODO:

it should raise an Exception if image already exists.

Note:

This method will not overwrite a previously existing image. If an image already exists at the given path then a dialog will be displayed prompting for overwrite.

Save the image to the file.

Examples:

browser.image.save("c:/foo/bar.jpg")

Parameters:

  • path (String)

    path to the file.



48
49
50
51
52
53
54
55
56
# File 'lib/watir-classic/image.rb', line 48

def save(path)
  @container.goto(src)
  begin
    fill_save_image_dialog(path)
    @container.document.execCommand("SaveAs")
  ensure
    @container.back
  end
end