Sha256: 279faa096a9a52645b91e13434298dd2c0eb6fd884c1273371b17cc5293ef0ae
Contents?: true
Size: 977 Bytes
Versions: 2
Compression:
Stored size: 977 Bytes
Contents
module Watir class FileField < InputElement #:stopdoc: INPUT_TYPES = ["file"] #:startdoc: def set(file_path) assert_file_exists(file_path) assert_exists click_no_wait set_file_name file_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) open_button.click end alias_method :value=, :set def assert_file_exists(file_path) raise Errno::ENOENT, "#{file_path} has to exist to set!" unless File.exists?(file_path) end def set_file_name(path_to_file) file_upload_window.text_field(:class => 'Edit', :index => 0).set path_to_file end def open_button file_upload_window.button(:value => /&Open|&Abrir/) end def cancel_button file_upload_window.button(:value => /Cancel/) end def file_upload_window @window ||= RAutomation::Window.new(:title => /^choose file( to upload)?|Elegir archivos para cargar$/i) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
watir-3.0.0.rc2 | lib/watir/dialogs/file_field.rb |
watir-3.0.0.rc1 | lib/watir/dialogs/file_field.rb |