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) byId(id, maxTime) → {Promise.<void>}
Waits for an element with a specific ID to be located within a maximum time.
Parameters:
Name | Type | Description |
---|---|---|
id | string | The ID of the element to wait for. |
maxTime | number | Maximum time to wait in milliseconds. |
Throws:
- Throws an error if the element is not found within the specified time.
- Type
- Error
Returns:
A promise that resolves when the element is found or the time times out.
- Type:
- Promise.<void>
(async) byIdAndVisible(id, maxTime) → {Promise.<void>}
Waits for an element with a specific ID to be located and visible within a maximum time.
Parameters:
Name | Type | Description |
---|---|---|
id | string | The ID of the element to wait for. |
maxTime | number | Maximum time to wait in milliseconds. |
Throws:
- Throws an error if the element is not found within the specified time.
- Type
- Error
Returns:
A promise that resolves when the element is found 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) bySelector(selector, maxTime) → {Promise.<void>}
Waits for an element located by a CSS selector to appear within a maximum time.
Parameters:
Name | Type | Description |
---|---|---|
selector | string | The CSS selector of the element to wait for. |
maxTime | number | Maximum time to wait in milliseconds. |
Throws:
- Throws an error if the element is not found within the specified time.
- Type
- Error
Returns:
A promise that resolves when the element is found or the time times out.
- Type:
- Promise.<void>
(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) byXpath(xpath, maxTime) → {Promise.<void>}
Waits for an element located by XPath to appear within a maximum time.
Parameters:
Name | Type | Description |
---|---|---|
xpath | string | The XPath of the element to wait for. |
maxTime | number | Maximum time to wait in milliseconds. |
Throws:
- Throws an error if the element is not found within the specified time.
- Type
- Error
Returns:
A promise that resolves when the element is found or the time times out.
- Type:
- Promise.<void>