Skip to content

Instantly share code, notes, and snippets.

@abotalov
Created November 4, 2013 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abotalov/7308732 to your computer and use it in GitHub Desktop.
Save abotalov/7308732 to your computer and use it in GitHub Desktop.
Attempt to reproduce issue from http://stackoverflow.com/q/19733271/841064
require "capybara"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium, app)
sess.visit("/")
sleep 1 # Just to verify that file isn't chosen
sess.attach_file('file_upload', '/tmp/temp.txt')
sleep 1 # Just to verify that file is chosen
__END__
<!doctype html>
<html>
<body>
<input type="file" name="file_upload">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment