Constructor
new Wait(session)
Creates a new Wait object for the session.
Parameters:
Name | Type | Description |
---|---|---|
session |
Session | the session that the wait will interact with |
Methods
setDefaultTimeout(timeout)
Sets the timeout value for all functions. The default is 10000 (10 seconds).
Parameters:
Name | Type | Description |
---|---|---|
timeout |
Number | timeout to use for all wait functions in milliseconds |
Throws:
-
- if column is out of range
- Type
- RangeError
forConnect(timeoutopt) → {Promise}
Waits for a connect request to complete.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
timeout |
Number |
<optional> |
timeout in milliseconds |
Returns:
- Resolved if the session is already connected or when it finally connects. Rejected if the wait times out.
- Type
- Promise
forDisconnect(timeoutopt) → {Promise}
Waits for a session disconnect request to complete.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
timeout |
Number |
<optional> |
timeout in milliseconds |
Returns:
- Resolved if the session is already disconnected, or when it finally disconnects. Rejected if the wait times out.
- Type
- Promise
forFixedTime(timeoutopt) → {Promise}
Waits unconditionally for a fixed time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
timeout |
Number |
<optional> |
timeout in milliseconds |
Returns:
- Resolved after the timeout has elapsed.
- Type
- Promise
forCursor(position, timeoutopt) → {Promise}
Waits for the cursor to arrive at the specified position.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
position |
Position | specifying the row and column. |
|
timeout |
Number |
<optional> |
timeout in milliseconds |
Throws:
-
- if column is out of range
- Type
- RangeError
Returns:
Resolved if the cursor is already in position, or when it is finally located. Rejected if the wait times out.
- Type
- Promise
forText(text, position, timeoutopt) → {Promise}
Waits for text at the specified position.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
text |
String | text to expect |
|
position |
Position | position specifying the row and column |
|
timeout |
Number |
<optional> |
timeout in milliseconds |
Throws:
-
if position is out of range
- Type
- RangeError
Returns:
- Resolved if the text is already at the specified position, or when it is finally found. Rejected if the wait times out.
- Type
- Promise
forHostPrompt(text, column, timeoutopt) → {Promise}
Waits for a command prompt located at a particular column on the screen.
This method is generally used with VT hosts where it is necessary to wait for a login or shell prompt. After the prompt is displayed the cursor will end up in a known column but the row is not necessarily consistent. To handle this situation, this method can be used to wait until the prompt has arrived.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
text |
String | prompt to expect |
|
column |
Number | where cursor is expected |
|
timeout |
Number |
<optional> |
timeout in milliseconds |
Throws:
-
- if column is out of range
- Type
- RangeError
Returns:
- Resolved if the conditions are already met, or when the conditions are finally met. Rejected if the wait times out.
- Type
- Promise
forScreenChange(timeout) → {Promise}
Waits for the host screen to change.
This method returns when a screen update is detected. It makes no guarantees about the number of subsequent updates that may arrive before the screen is complete. Waiting repeatedly until the screen contents match some known stopping criteria is advisable.
Parameters:
Name | Type | Description |
---|---|---|
timeout |
Number | in milliseconds. |
Returns:
resolved if the screen changes. Rejected if the wait times out.
- Type
- Promise