1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Emulate click on file input when attaching file using Selenium with Chrome and Firefox

This commit is contained in:
Thomas Walpole 2019-08-16 14:21:20 -07:00
parent 2e052792a5
commit ea6486b328
7 changed files with 40 additions and 5 deletions

View file

@ -1,12 +1,18 @@
# frozen_string_literal: true
require 'capybara/selenium/extensions/html5_drag'
require 'capybara/selenium/extensions/file_input_click_emulation'
class Capybara::Selenium::FirefoxNode < Capybara::Selenium::Node
include Html5Drag
include FileInputClickEmulation
def click(keys = [], **options)
super
rescue Selenium::WebDriver::Error::InvalidArgumentError
return emulate_click if attaching_file? && visible_file_field?
raise
rescue ::Selenium::WebDriver::Error::ElementNotInteractableError
if tag_name == 'tr'
warn 'You are attempting to click a table row which has issues in geckodriver/marionette - '\