AddText

Provides functionality to add text to elements on a web page using various selectors.

Classes

AddText

Methods

(async) byClassName(text, className) → {Promise.<void>}

Adds text to an element identified by its class name.
Parameters:
NameTypeDescription
textstringThe text string to add.
classNamestringThe class name of the element.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the text has been added.
Type: 
Promise.<void>
Example
commands.addText.byClassName('mytext', 'className');

(async) byId(text, id) → {Promise.<void>}

Adds text to an element identified by its ID.
Parameters:
NameTypeDescription
textstringThe text string to add.
idstringThe ID of the element.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the text has been added.
Type: 
Promise.<void>
Example
commands.addText.byId('mytext', 'id');

(async) byName(text, name) → {Promise.<void>}

Adds text to an element identified by its name attribute.
Parameters:
NameTypeDescription
textstringThe text string to add.
namestringThe name attribute of the element.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the text has been added.
Type: 
Promise.<void>
Example
commands.addText.byName('mytext', 'name');

(async) bySelector(text, selector) → {Promise.<void>}

Adds text to an element identified by its CSS selector.
Parameters:
NameTypeDescription
textstringThe text string to add.
selectorstringThe CSS selector of the element.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the text has been added.
Type: 
Promise.<void>
Example
commands.addText.bySelector('mytext', 'selector');

(async) byXpath(text, xpath) → {Promise.<void>}

Adds text to an element identified by its XPath.
Parameters:
NameTypeDescription
textstringThe text string to add.
xpathstringThe XPath of the element.
Throws:
Throws an error if the element is not found.
Type
Error
Returns:
A promise that resolves when the text has been added.
Type: 
Promise.<void>
Example
commands.addText.byXpath('mytext', 'xpath');