You can use
page.driver.dismiss_js_confirms! in your tests.
# spec/features/delete_post_spec.rb feature 'Delete post', js:true do scenario 'does not delete post without accepting confirmation' do page.driver.dismiss_js_confirms! # create post, visit post page click_link 'Delete posts' expect(page).not_to have_content 'Post has been deleted.' end end
For more information check capybara-webkit github repository.