class Watir::FileField

Public Instance Methods

set(path) click to toggle source

Set the file field to the given path

@param [String] path @raise [Errno::ENOENT] if the file doesn't exist

# File lib/watir/elements/file_field.rb, line 10
def set(path)
  raise Errno::ENOENT, path unless File.exist?(path)

  self.value = path
end
Also aliased as: upload
upload(path)
Alias for: set
value=(path) click to toggle source

Sets the file field to the given path

@param [String] path

# File lib/watir/elements/file_field.rb, line 23
def value=(path)
  path = path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
  element_call { @element.send_keys path }
end