diff --git a/lib/capybara/selenium/node.rb b/lib/capybara/selenium/node.rb index cc8f37a73c..60ba4f6f9e 100644 --- a/lib/capybara/selenium/node.rb +++ b/lib/capybara/selenium/node.rb @@ -353,7 +353,9 @@ def update_value_js(value) arguments[0].focus(); } if (arguments[0].value != arguments[1]) { - arguments[0].value = arguments[1] + var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set; + nativeInputValueSetter.call(arguments[0], arguments[1]); + arguments[0].dispatchEvent(new InputEvent('input')); arguments[0].dispatchEvent(new Event('change', { bubbles: true })); }