Skip to content

text()

This selector lets you identify an element with text. Looks for exact match if not found does contains, accepts proximity selectors.

await highlight(text('Vehicle'))
await text('Vehicle').exists()
await text('Vehicle', below('text')).exists()
await text('Vehicle', { exactMatch: true }, below('text')).exists()
await text('/Vehicle/').exists() //regex as string
await text(/Vehicle/).exists()
await text(new RegExp('Vehicle')).exists()
NameTypeDescription
textstring | RegExpText/regex to match.
_optionsObject
_options.exactMatchbooleanOption to look for exact match. Default: false.
argsrelativeSelectorProximity selectors
TypeDescription
TextWrapper