Returns text from an element. For inputs use getValue instead.
getValue
const title = await getText(ctx, 'h1[id="title"]'); Copy
const title = await getText(ctx, 'h1[id="title"]');
Context object.
The element selector for which to return text.
Element text content as a string.
Returns the value of a form element.
The element selector for which to return value.
Optional
The value of the form element as a string.
const firstName = await getValue(ctx, 'input[name="firstName"]'); Copy
const firstName = await getValue(ctx, 'input[name="firstName"]');
Returns text from an element. For inputs use
getValue
instead.Example
Param: ctx
Context object.
Param: selector
The element selector for which to return text.
Returns
Element text content as a string.