Module: WatirRobot::FileField

Included in:
KeywordLibrary
Defined in:
lib/watir_robot/keywords/file_field.rb

Overview

Functionality for HTML file-upload fields

Instance Method Summary collapse

Instance Method Details

#choose_file(loc, path) ⇒ Object

Insert path of a file into a file-upload field

Parameters:

  • loc (String)

    attribute/value pairs that match an HTML element

  • path (String)

    the path to the file you wish to upload from your computer



16
17
18
# File 'lib/watir_robot/keywords/file_field.rb', line 16

def choose_file(loc, path)
  @browser.file_field(parse_location(loc)).set path
end

#get_filefield_path(loc) ⇒ Object

Get the file path present in a file-upload field

Parameters:

  • loc (String)

    attribute/value pairs that match an HTML element

  • the (String)

    path of the file in a file-upload field



26
27
28
# File 'lib/watir_robot/keywords/file_field.rb', line 26

def get_filefield_path(loc)
  @browser.file_field(parse_location(loc)).value
end