# File lib/capybara/node/actions.rb, line 155 def attach_file(locator, path) raise Capybara::FileNotFound, "cannot attach file, #{path} does not exist" unless File.exist?(path.to_s) msg = "cannot attach file, no file field with id, name, or label '#{locator}' found" find(:xpath, XPath::HTML.file_field(locator), :message => msg).set(path) end