Check if an elements inner text matches a regular expression.

Usage

Example

this.demoTest = function (browser) {
  browser.assert.textMatches('#main', '^Nightwatch');
};

Parameters

Name Type description
definition string | object

The selector (CSS/Xpath) used to locate the element. Can either be a string or an object which specifies element properties.

regexExpression string | RegExp

Regex expression to match text.

msg
Optional
string

Optional log message to display in the output. If missing, one is displayed by default.