Only clear Firefox file input when necessary

This commit is contained in:
Thomas Walpole 2018-08-31 15:26:01 -07:00
parent dffdfcfd1c
commit 6261641d70
1 changed files with 2 additions and 1 deletions

View File

@ -26,7 +26,8 @@ class Capybara::Selenium::MarionetteNode < Capybara::Selenium::Node
end
def set_file(value) # rubocop:disable Naming/AccessorMethodName
native.clear # By default files are appended so we have to clear here
# By default files are appended so we have to clear here if its multiple and already set
native.clear if multiple? && driver.evaluate_script("arguments[0].files", self).any?
return super if browser_version >= 62.0
# Workaround lack of support for multiple upload by uploading one at a time