Sha256: d15aec3118b788630e525fd7495cecefc0f78d7d87dd3f0d64a6e0e36e38245e
Contents?: true
Size: 866 Bytes
Versions: 17
Compression:
Stored size: 866 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 open_button.click end def assert_file_exists(file_path) raise WatirException, "#{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') end def cancel_button file_upload_window.button(:value => 'Cancel') end def file_upload_window @window ||= RAutomation::Window.new(:title => /^choose file( to upload)?$/i) end end end
Version data entries
17 entries across 17 versions & 1 rubygems