Classes
Methods
(async) byCondition(jsExpression, maxTime) → {Promise.<void>}
Waits for a JavaScript condition to return a truthy value within a maximum time.
Parameters:
| Name | Type | Description |
|---|---|---|
jsExpression | string | The JavaScript expression to evaluate. |
maxTime | number | Maximum time to wait in milliseconds. |
Throws:
- Throws an error if the condition is not met within the specified time.
- Type
- Error
Returns:
A promise that resolves when the condition becomes truthy or the time times out.
- Type:
- Promise.<void>
(async) byPageToComplete() → {Promise.<void>}
Waits for the page to finish loading.
Returns:
A promise that resolves when the page complete check has finished.
- Type:
- Promise.<void>
Example
async commands.wait.byPageToComplete();(async) byTime(ms) → {Promise.<void>}
Waits for a specified amount of time.
Parameters:
| Name | Type | Description |
|---|---|---|
ms | number | The time in milliseconds to wait. |
Returns:
A promise that resolves when the specified time has elapsed.
- Type:
- Promise.<void>
Example
async commands.wait.byTime(1000);(async) run(selector, optionsopt) → {Promise.<void>}
Waits for an element using a unified selector string to appear within a maximum time. Supports CSS selectors (default), and prefix-based strategies: 'id:myId', 'xpath://div', 'name:field', 'class:loaded'.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
selector | string | The selector string. CSS by default, or use a prefix. | ||||||||||||||||
options | Object | <optional> | Options for waiting.Properties
|
Throws:
- Throws an error if the element is not found within the timeout.
- Type
- Error
Returns:
A promise that resolves when the element is found.
- Type:
- Promise.<void>