Definition
Fields
has
ElementOptions
Narrows down the selection to elements that have a descendant matching these ElementOptions.
Example: To find a list item that contains a link with text “Details”:
element(selector: "li", filter: { has: { role: "link", text: "Details" } })
hasNot
ElementOptions
Narrows down the selection to elements that DO NOT have a descendant matching these ElementOptions.
Example: To find a product item that does not contain a “Sold Out” badge:
element(selector: ".product", filter: { hasNot: { text: "Sold Out" } })
hasNotText
String
Filters elements that DO NOT contain the specified text anywhere in their DOM subtree.
The match is case-insensitive. Can be a string or a regular expression pattern.
Example: hasNotText: "spam" or hasNotText: "/advertisement/i"
hasText
String
Filters elements that contain the specified text anywhere in their DOM subtree.
The match is case-insensitive. Can be a string or a regular expression pattern.
Example: hasText: "important" or hasText: "/urgent/i"