Selectors
#
@ByIdSelects an element by id
attribute:
#
@ByTypeSelects an elements by its type, e.g. button
, div
, input
e.t.c:
#
@ByClassSelects an element by its class:
#
@ByAttributeSelects an element by attribute:
By default, ByAttribute
queries elements with cypress-id
attribute (Selectors.header
selector), but the attribute can be specified explicitly as for Selectors.listing
selector.
The default attribute can also be configured globally.
#
@BySelectorSelects an element by a CSS selector:
#
@ByXPathSelects an element by XPath selector:
note
Fox XPath selectors, that do not specify parent
, use absolute location path (e.g. //div
).
For children
selectors, that specify parent
selector, use relative location path (e.g. ./div
).
#
@ByNameSelects an element by name
attribute:
#
@ByExactTextSelects an element that has specified exact text:
By default, ByExactText
is case sensitive. To ignore case sensitivity, set ignoreCase
to true
as in the second example.
#
@ByPartialTextSelects an element that contains specified partial text:
By default, ByPartialText
is case sensitive. To ignore case sensitivity, set ignoreCase
to true
as in the second example.
#
@ByExactLinkTextSelects a link that has specified exact text:
By default, ByExactLinkText
is case sensitive. To ignore case sensitivity, set ignoreCase
to true
as in the second example.
#
@ByPartialLinkTextSelects a link that contains specified partial text:
By default, ByPartialLinkText
is case sensitive. To ignore case sensitivity, set ignoreCase
to true
as in the second example.