JavaScript

Provides functionality to execute JavaScript code in the context of the current page.

Classes

JavaScript

Methods

(async) run(js) → {Promise.<*>}

Executes a JavaScript script.
Parameters:
NameTypeDescription
jsstringThe JavaScript code to execute.
Throws:
Throws an error if the JavaScript cannot be executed.
Type
Error
Returns:
A promise that resolves with the result of the executed script.
Type: 
Promise.<*>

(async) runAndWait(js) → {Promise.<*>}

Executes a JavaScript script and waits for the page complete check to finish.
Parameters:
NameTypeDescription
jsstringThe JavaScript code to execute.
Throws:
Throws an error if the JavaScript cannot be executed.
Type
Error
Returns:
A promise that resolves with the result of the executed script and the completion of the page load.
Type: 
Promise.<*>

(async) runPrivileged(js) → {Promise.<*>}

Executes synchronous privileged JavaScript.
Parameters:
NameTypeDescription
jsstringThe privileged JavaScript code to execute.
Throws:
Throws an error if the privileged JavaScript cannot be executed.
Type
Error
Returns:
A promise that resolves with the result of the executed privileged script.
Type: 
Promise.<*>

(async) runPrivilegedAndWait(js) → {Promise.<*>}

Executes synchronous privileged JavaScript and waits for the page complete check to finish.
Parameters:
NameTypeDescription
jsstringThe privileged JavaScript code to execute.
Throws:
Throws an error if the privileged JavaScript cannot be executed.
Type
Error
Returns:
A promise that resolves with the result of the executed privileged script and the completion of the page load.
Type: 
Promise.<*>

(async) runPrivilegedAsync(js) → {Promise.<*>}

Executes asynchronous privileged JavaScript.
Parameters:
NameTypeDescription
jsstringThe asynchronous privileged JavaScript code to execute.
Throws:
Throws an error if the asynchronous privileged JavaScript cannot be executed.
Type
Error
Returns:
A promise that resolves with the result of the executed asynchronous privileged script.
Type: 
Promise.<*>