capybara/node/matchers.py
def assert_no_selector(self, *args, **kwargs):
        """
        Asserts that a given selector is not on the page or a descendant of the current node. Usage
        is identical to :meth:`assert_selector`.

        Query options such as ``count``, ``minimum``, and ``between`` are considered to be an
        integral part of the selector. This will return True, for example, if a page contains 4
        anchors but the query expects 5::

            page.assert_no_selector("a", minimum=1)  # Found, raises ExpectationNotMet
            page.assert_no_selector("a", count=4)    # Found, raises ExpectationNotMet
            page.assert_no_selector("a", count=5)    # Not Found, returns True

        Args:
            *args: Variable length argument list for :class:`SelectorQuery`.
            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.

        Returns:
            True

        Raises:
            ExpectationNotMet: The given selector matched.
        """

        query = SelectorQuery(*args, **kwargs)

        @self.synchronize(wait=query.wait)
        def assert_no_selector():
            result = query.resolve_for(self)

            if result.matches_count and (
                   len(result) > 0 or expects_none(query.options)):
                raise ExpectationNotMet(result.negative_failure_message)

            return True

        return assert_no_selector()
def assert_no_selector(self, *args, **kwargs):
        """
        Asserts that a given selector is not on the page or a descendant of the current node. Usage
        is identical to :meth:`assert_selector`.

        Query options such as ``count``, ``minimum``, and ``between`` are considered to be an
        integral part of the selector. This will return True, for example, if a page contains 4
        anchors but the query expects 5::

            page.assert_no_selector("a", minimum=1)  # Found, raises ExpectationNotMet
            page.assert_no_selector("a", count=4)    # Found, raises ExpectationNotMet
            page.assert_no_selector("a", count=5)    # Not Found, returns True

        Args:
            *args: Variable length argument list for :class:`SelectorQuery`.
            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.

        Returns:
            True

        Raises:
            ExpectationNotMet: The given selector matched.
        """

        query = SelectorQuery(*args, **kwargs)

        @self.synchronize(wait=query.wait)
        def assert_no_selector():
            result = query.resolve_for(self)

            if result.matches_count and (
                   len(result) > 0 or expects_none(query.options)):
                raise ExpectationNotMet(result.negative_failure_message)

            return True

        return assert_no_selector()
Asserts that a given selector is not on the page or a descendant of the current node. Usage
        is identical to :meth:`assert_selector`.

        Query options such as ``count``, ``minimum``, and ``between`` are considered to be an
        integral part of the selector. This will return True, for example, if a page contains 4
        anchors but the query expects 5::

            page.assert_no_selector("a", minimum=1)  # Found, raises ExpectationNotMet
            page.assert_no_selector("a", count=4)    # Found, raises ExpectationNotMet
            page.assert_no_selector("a", count=5)    # Not Found, returns True

        Args:
            *args: Variable length argument list for :class:`SelectorQuery`.
            **kwargs: Arbitrary keyword arguments for :class:`SelectorQuery`.

        Returns:
            True

        Raises:
            ExpectationNotMet: The given selector matched.