lib/capybara/node/actions.rb in capybara-3.28.0 vs lib/capybara/node/actions.rb in capybara-3.29.0
- old
+ new
@@ -286,9 +286,10 @@
if block_given?
begin
execute_script CAPTURE_FILE_ELEMENT_SCRIPT
yield
file_field = evaluate_script 'window._capybara_clicked_file_input'
+ raise ArgumentError, "Capybara was unable to determine the file input you're attaching to" unless file_field
rescue ::Capybara::NotSupportedByDriverError
warn 'Block mode of `#attach_file` is not supported by the current driver - ignoring.'
end
end
# Allow user to update the CSS style of the file input since they are so often hidden on a page