class Watir::FileField

Public Instance Methods

set(path) click to toggle source

Set the file field to the given path

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

# File lib/watir-webdriver/elements/file_field.rb, line 11
def set(path)
  raise Errno::ENOENT, path unless File.exist?(path)
  self.value = path
end
value=(path) click to toggle source

Sets the file field to the given path

@param [String] path

# File lib/watir-webdriver/elements/file_field.rb, line 22
def value=(path)
  path = path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
  send_keys path
end