Troubleshoot: Capybara: Unable to find xpath /html (Capybara::ElementNotFound)
11 March 2022 (Updated 29 April 2022)
On this page
Error
Unable to find xpath "/html" (Capybara::ElementNotFound)
Possible fix:
If using turbo-rails
, make sure that the action your form is submitting to is returning a response. For example, this error can be caused when you have an empty action like this:
class ArticlesController < ApplicationController
def update
end
end
and your form makes a PUT or PATCH request to /articles
.
Tagged:
Rails testing
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment