With Capybara, you can trigger click events instead of directly clicking on such an element:
page.find("#some_element").trigger("click")
The problem is that this does not work in Selenium. So what you can do is conditionally execute a standard capybara click or trigger("click") based on the current javascript driver, which will look something like this:
if Capybara.javascript_driver == :selenium page.find("#some_element").click else page.find("#some_element").trigger("click") end
Obviously, this is less than ideal, but this is the best way I've come across such situations.
Shane O'Connor
source share