Module: Selenium::WebDriver::DriverExtensions::UploadsFiles Private
- Defined in:
- lib/selenium/webdriver/common/driver_extensions/uploads_files.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#file_detector=(detector) ⇒ Object
private
Set the file detector to pass local files to a remote WebDriver.
Instance Method Details
#file_detector=(detector) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set the file detector to pass local files to a remote WebDriver.
The detector is an object that responds to #call, and when called will determine if the given string represents a file. If it does, the path to the file on the local file system should be returned, otherwise nil or false.
Example:
driver = Selenium::WebDriver.for :remote
driver.file_detector = lambda do |args|
# args => ["/path/to/file"]
str if File.exist?(args.first.to_s)
end
driver.find_element(:id => "upload").send_keys "/path/to/file"
By default, no file detection is performed.
32 33 34 35 36 37 38 |
# File 'lib/selenium/webdriver/common/driver_extensions/uploads_files.rb', line 32 def file_detector=(detector) unless detector.nil? or detector.respond_to? :call raise ArgumentError, "detector must respond to #call" end bridge.file_detector = detector end |