Classes
Methods
(async) byClassName(text, className) → {Promise.<void>}
Adds text to an element identified by its class name.
Parameters:
Name | Type | Description |
---|---|---|
text | string | The text string to add. |
className | string | The 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:
Name | Type | Description |
---|---|---|
text | string | The text string to add. |
id | string | The 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:
Name | Type | Description |
---|---|---|
text | string | The text string to add. |
name | string | The 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:
Name | Type | Description |
---|---|---|
text | string | The text string to add. |
selector | string | The 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:
Name | Type | Description |
---|---|---|
text | string | The text string to add. |
xpath | string | The 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');