Sha256: 08d8dae82dc138987d8cd3b85c82671691ca62164bb63f2b8c794b26caaac6f2

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

module Selenium
  module WebDriver

    #
    # @api private
    #

    module DriverExtensions
      module UploadsFiles

        #
        # 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.
        #
        # @api public
        #

        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

      end # UploadsFiles
    end # DriverExtensions
  end # WebDriver
end # Selenium

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
selenium-webdriver-2.16.0 lib/selenium/webdriver/common/driver_extensions/uploads_files.rb
selenium-webdriver-2.15.0 lib/selenium/webdriver/common/driver_extensions/uploads_files.rb
selenium-webdriver-2.14.0 lib/selenium/webdriver/common/driver_extensions/uploads_files.rb