Methods
(async) addPreloadScript(functionDeclaration, argumentValueListopt, sandbox|nullopt) → {Promise.<number>}
Adds a preload script.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
functionDeclaration | string | The declaration of the function to be added as a preload script. | ||
argumentValueList | Array.<LocalValue> | <optional> | [] | The list of argument values to be passed to the preload script function. |
sandbox|null | string | <optional> | The sandbox object to be used for the preload script. |
- Source
- A promise that resolves to the added preload script ID.
- Type:
- Promise.<number>
(async) callFunctionInBrowsingContext(realmId, functionDeclaration, awaitPromise, argumentValueList|nullopt, thisParameter|nullopt, resultOwnership|nullopt) → {Promise.<(EvaluateResultSuccess|EvaluateResultException)>}
Calls a function in the specified browsing context.
Name | Type | Attributes | Description |
---|---|---|---|
realmId | string | The ID of the browsing context. | |
functionDeclaration | string | The function to call. | |
awaitPromise | boolean | Whether to await the promise returned by the function. | |
argumentValueList|null | Array.<LocalValue> | <optional> | The list of argument values to pass to the function. |
thisParameter|null | Object | <optional> | The value of 'this' parameter for the function. |
resultOwnership|null | ResultOwnership | <optional> | The ownership of the result. |
- Source
- A promise that resolves to the evaluation result or exception.
- Type:
- Promise.<(EvaluateResultSuccess|EvaluateResultException)>
(async) callFunctionInRealm(realmId, functionDeclaration, awaitPromise, argumentValueList|nullopt, thisParameter|nullopt, resultOwnership|nullopt) → {Promise.<(EvaluateResultSuccess|EvaluateResultException)>}
Calls a function in the specified realm.
Name | Type | Attributes | Description |
---|---|---|---|
realmId | string | The ID of the realm. | |
functionDeclaration | string | The function to call. | |
awaitPromise | boolean | Whether to await the promise returned by the function. | |
argumentValueList|null | Array.<LocalValue> | <optional> | The list of argument values to pass to the function. |
thisParameter|null | Object | <optional> | The value of 'this' parameter for the function. |
resultOwnership|null | ResultOwnership | <optional> | The ownership of the result. |
- Source
- A promise that resolves to the evaluation result or exception.
- Type:
- Promise.<(EvaluateResultSuccess|EvaluateResultException)>
(async) disownBrowsingContextScript(browsingContextId, handles, sandboxopt) → {Promise.<void>}
Disowns the handles in the specified browsing context.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
browsingContextId | string | The ID of the browsing context. | ||
handles | Array.<string> | The handles to disown to allow garbage collection. | ||
sandbox | String | | <optional> | null | The sandbox name. |
- Source
- A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) disownRealmScript(realmId, handles) → {Promise.<void>}
Disowns the handles in the specified realm.
Name | Type | Description |
---|---|---|
realmId | string | The ID of the realm. |
handles | Array.<string> | The handles to disown to allow garbage collection. |
- Source
- A promise that resolves when the command is sent.
- Type:
- Promise.<void>
(async) evaluateFunctionInBrowsingContext(realmId, expression, awaitPromise, resultOwnership) → {Promise.<(EvaluateResultSuccess|EvaluateResultException)>}
Evaluates a function in the browsing context.
Name | Type | Description |
---|---|---|
realmId | string | The ID of the browsing context. |
expression | string | The expression to function to evaluate. |
awaitPromise | boolean | Whether to await the promise. |
resultOwnership | ResultOwnership | | The ownership of the result. |
- Source
- A promise that resolves to the evaluation result or exception.
- Type:
- Promise.<(EvaluateResultSuccess|EvaluateResultException)>
(async) evaluateFunctionInRealm(realmId, expression, awaitPromise, resultOwnership) → {Promise.<(EvaluateResultSuccess|EvaluateResultException)>}
Evaluates a function in the specified realm.
Name | Type | Default | Description |
---|---|---|---|
realmId | string | The ID of the realm. | |
expression | string | The expression to function to evaluate. | |
awaitPromise | boolean | Whether to await the promise. | |
resultOwnership | ResultOwnership | | null | The ownership of the result. |
- Source
- A promise that resolves to the evaluation result or exception.
- Type:
- Promise.<(EvaluateResultSuccess|EvaluateResultException)>
(async) getAllRealms() → {Promise.<Array.<RealmInfo>>}
Retrieves all realms.
- Source
- A promise that resolves to an array of RealmInfo objects.
- Type:
- Promise.<Array.<RealmInfo>>
(async) getRealmsByType(type) → {Promise.<Array.<RealmInfo>>}
Retrieves the realms by type.
Name | Type | Description |
---|---|---|
type | Type | The type of realms to retrieve. |
- Source
- A promise that resolves to an array of RealmInfo objects.
- Type:
- Promise.<Array.<RealmInfo>>
(async) getRealmsInBrowsingContext(browsingContext) → {Promise.<Array.<RealmInfo>>}
Retrieves the realms in the specified browsing context.
Name | Type | Description |
---|---|---|
browsingContext | string | The browsing context ID. |
- Source
- A promise that resolves to an array of RealmInfo objects.
- Type:
- Promise.<Array.<RealmInfo>>
(async) getRealmsInBrowsingContextByType(browsingContext, type) → {Promise.<Array.<RealmInfo>>}
Retrieves the realms in a browsing context based on the specified type.
Name | Type | Description |
---|---|---|
browsingContext | string | The browsing context ID. |
type | string | The type of realms to retrieve. |
- Source
- A promise that resolves to an array of RealmInfo objects.
- Type:
- Promise.<Array.<RealmInfo>>
(async) onMessage(callback) → {Promise.<void>}
Subscribes to the 'script.message' event and handles the callback function when a message is received.
Name | Type | Description |
---|---|---|
callback | function | The callback function to be executed when a message is received. |
- Source
- A promise that resolves when the subscription is successful.
- Type:
- Promise.<void>
(async) onRealmCreated(callback) → {Promise.<void>}
Subscribes to the 'script.realmCreated' event and handles it with the provided callback.
Name | Type | Description |
---|---|---|
callback | function | The callback function to handle the 'script.realmCreated' event. |
- Source
- A promise that resolves when the subscription is successful.
- Type:
- Promise.<void>
(async) onRealmDestroyed(callback) → {Promise.<void>}
Subscribes to the 'script.realmDestroyed' event and handles it with the provided callback function.
Name | Type | Description |
---|---|---|
callback | function | The callback function to be executed when the 'script.realmDestroyed' event occurs. |
- Source
- A promise that resolves when the subscription is successful.
- Type:
- Promise.<void>
(async) removePreloadScript(script) → {Promise.<any>}
Removes a preload script.
Name | Type | Description |
---|---|---|
script | string | The ID for the script to be removed. |
- Source
- If an error occurs during the removal process.
- Type
- WebDriverError
- A promise that resolves with the result of the removal.
- Type:
- Promise.<any>