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:
parent
2e052792a5
commit
ea6486b328
7 changed files with 40 additions and 5 deletions
|
@ -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 - '\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue