Reputation: 4614
I am trying to write an integration test using Capybara and capybara-webkit. I am stuck on trying to confirm an alert dialog. The documentation for capybara-webkit says to set Capybara.javascript_driver = :webkit
which I have done, but I don't see how this would affect Capybara::page.driver, which I think is supposed to respond to accept_alert
:
def test_update_key
Capybara.javascript_driver = :webkit
visit account_path accounts(:pending_account)
click_link "edit_account_key"
page.accept_alert "Would you like to edit this account key?" do # error on this line
click_button('OK')
end
end
this code gives me the following error:
Capybara::NotSupportedByDriverError Exception: Capybara::Driver::Base#accept_modal
I am currently using rails (4.0.13), capybara (2.4.4), capybara-webkit (1.4.1)
Upvotes: 3
Views: 2770
Reputation: 4614
I don't know what Capybara.javascript_driver = :webkit
is supposed to do, but it didn't do anything for me. I finally resolved the issue by putting Capybara.current_driver = :webkit
in the top of my test.
However, webkit was still unable to accept the alert; I just changed the driver to Selenium for now, as that runs without issues. I had wanted to use webkit because it's headless, and reportedly faster, but I don't have a lot of tests written yet, so speed isn't an issue at this point. May have to revisit later.
Upvotes: 2