teamcapybara/capybara · error · Capybara::ExpectationNotMet
expected #{@actual_title.inspect} to #{verb} #{@expected_tit
Error message
expected #{@actual_title.inspect} to #{verb} #{@expected_title.inspect} What it means
Error "expected #{@actual_title.inspect} to #{verb} #{@expected_title.inspect}" thrown in teamcapybara/capybara.
Source
Thrown at lib/capybara/node/document_matchers.rb:21
module Capybara
module Node
module DocumentMatchers
##
# Asserts that the page has the given title.
#
# @!macro title_query_params
# @overload $0(string, **options)
# @param string [String] The string that title should include
# @overload $0(regexp, **options)
# @param regexp [Regexp] The regexp that title should match to
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time that Capybara will wait for title to eq/match given string/regexp argument
# @option options [Boolean] :exact (false) When passed a string should the match be exact or just substring
# @raise [Capybara::ExpectationNotMet] if the assertion hasn't succeeded during wait time
# @return [true]
#
def assert_title(title, **options)
_verify_title(title, options) do |query|
raise Capybara::ExpectationNotMet, query.failure_message unless query.resolves_for?(self)
end
end
##
# Asserts that the page doesn't have the given title.
#
# @macro title_query_params
# @raise [Capybara::ExpectationNotMet] if the assertion hasn't succeeded during wait time
# @return [true]
#
def assert_no_title(title, **options)
_verify_title(title, options) do |query|
raise Capybara::ExpectationNotMet, query.negative_failure_message if query.resolves_for?(self)
end
end
##
# Checks if the page has the given title.View on GitHub (pinned to 15b5fdb76e)
When it happens
Trigger: Thrown at lib/capybara/node/document_matchers.rb:21 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of teamcapybara/capybara@15b5fdb76e (2026-08-21).
Data as JSON: /api/errors/f1a5b25004737a55.
Report an issue: GitHub.