class Capybara::Queries::TextQuery

def invisible_message

def invisible_message
  invisible_text = text(query_type: :all)
  invisible_count = invisible_text.scan(@search_regexp).size
  return if invisible_count == @count
  "it was found #{occurrences invisible_count} including non-visible text"
rescue StandardError
  # An error getting the non-visible text (if element goes out of scope) should not affect the response
  nil
end