def assert_matches_selector(self, *args, **kwargs):
query = SelectorQuery(*args, **kwargs)<EOL>@self.synchronize(wait=query.wait)<EOL>def assert_matches_selector():<EOL><INDENT>result = query.resolve_for(self.find_first("<STR_LIT>", "<STR_LIT>", minimum=<NUM_LIT:0>) or self.query_scope)<EOL>if self not in result:<EOL><INDENT>raise ExpectationNotMet("<STR_LIT>")<EOL><DEDENT>return True<EOL><DEDENT>return assert_matches_selector()<EOL>
Asserts that the current node matches a given selector. ::

    node.assert_matches_selector("p#foo")
    node.assert_matches_selector("xpath", "//p[@id='foo']")

It also accepts all options that :meth:`find_all` accepts, such as ``text`` and
``visible``. ::

    node.assert_matches_selector("li", text="Horse", visible=True)

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

Returns:
    True

Raises:
    ExpectationNotMet: If the selector does not match.