Selectors
@ById#
Selects an element by id attribute:
@ByType#
Selects an elements by its type, e.g. button, div, input e.t.c:
@ByClass#
Selects an element by its class:
@ByAttribute#
Selects 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.
@BySelector#
Selects an element by a CSS selector:
@ByXPath#
Selects 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).
@ByName#
Selects an element by name attribute:
@ByExactText#
Selects 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.
@ByPartialText#
Selects 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.
@ByExactLinkText#
Selects 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.
@ByPartialLinkText#
Selects 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.