Method: Watir::Container#file_field

Defined in:
lib/watir/container.rb

#file_field(how, what = nil) ⇒ Object Also known as: fileField

This is the main method for accessing a file field. Usually an <input type = file> HTML tag.

*  how   - symbol - how we access the field, valid values are
  :index      - find the file field using index
  :id         - find the file field using id attribute
  :name       - find the file field using name attribute
  :xpath      - find the file field using xpath query
*  what  - string, integer, regular expression, or xpath query - what we are looking for,

returns a FileField object

Typical Usage

browser.file_field(:id,   'up_1')                     # access the file upload field with an ID of up_1
browser.file_field(:name, 'upload')                   # access the file upload field with a name of upload
browser.file_field(:index, 2)                         # access the second file upload on the page (1 based, so the first field is accessed with :index,1)


271
272
273
# File 'lib/watir/container.rb', line 271

def file_field(how, what=nil)
  FileField.new(self, how, what)
end