Method: Capybara::Node::Matchers#has_no_text?

Defined in:
lib/capybara/node/matchers.rb

#has_no_text?(type, text, **options) ⇒ Boolean #has_no_text?(text, **options) ⇒ Boolean Also known as: has_no_content?

Checks if the page or current node does not have the given text content, ignoring any HTML tags and normalizing whitespace.

Overloads:

  • #has_no_text?(type, text, **options) ⇒ Boolean

    Parameters:

    • type (:all, :visible)

      Whether to check for only visible or all text. If this parameter is missing or nil then we use the value of ignore_hidden_elements, which defaults to true, corresponding to :visible.

    • text (String, Regexp)

      The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.

    Options Hash (**options):

    • :count (Integer) — default: nil

      Number of times the text is expected to occur

    • :minimum (Integer) — default: nil

      Minimum number of times the text is expected to occur

    • :maximum (Integer) — default: nil

      Maximum number of times the text is expected to occur

    • :between (Range) — default: nil

      Range of times that is expected to contain number of times text occurs

    • :wait (Numeric)

      Maximum time that Capybara will wait for text to eq/match given string/regexp argument. Defaults to default_max_wait_time.

    • :exact (Boolean)

      Whether text must be an exact match or just substring. Defaults to exact_text.

    • :normalize_ws (Boolean) — default: false

      When true replace all whitespace with standard spaces and collapse consecutive whitespace to a single space

  • #has_no_text?(text, **options) ⇒ Boolean

    Parameters:

    • text (String, Regexp)

      The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.

    Options Hash (**options):

    • :count (Integer) — default: nil

      Number of times the text is expected to occur

    • :minimum (Integer) — default: nil

      Minimum number of times the text is expected to occur

    • :maximum (Integer) — default: nil

      Maximum number of times the text is expected to occur

    • :between (Range) — default: nil

      Range of times that is expected to contain number of times text occurs

    • :wait (Numeric)

      Maximum time that Capybara will wait for text to eq/match given string/regexp argument. Defaults to default_max_wait_time.

    • :exact (Boolean)

      Whether text must be an exact match or just substring. Defaults to exact_text.

    • :normalize_ws (Boolean) — default: false

      When true replace all whitespace with standard spaces and collapse consecutive whitespace to a single space

Returns:

  • (Boolean)

    Whether it doesn't exist



750
751
752
# File 'lib/capybara/node/matchers.rb', line 750

def has_no_text?(*args, **options)
  make_predicate(options) { assert_no_text(*args, **options) }
end