JavaScriptExecutor
in
WebDriver interface implemented by drivers that support JavaScript.
Table of Contents
Methods
- executeAsyncScript() : mixed
- Inject a snippet of JavaScript into the page for asynchronous execution in the context of the currently selected frame.
- executeScript() : mixed
- Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. The executed script is assumed to be synchronous and the result of evaluating the script will be returned.
Methods
executeAsyncScript()
Inject a snippet of JavaScript into the page for asynchronous execution in the context of the currently selected frame.
public
executeAsyncScript(string $script[, array<string|int, mixed> $arguments = [] ]) : mixed
The driver will pass a callback as the last argument to the snippet, and block until the callback is invoked.
Parameters
- $script : string
-
The script to inject.
- $arguments : array<string|int, mixed> = []
-
The arguments of the script.
Tags
Return values
mixed —The value passed by the script to the callback.
executeScript()
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. The executed script is assumed to be synchronous and the result of evaluating the script will be returned.
public
executeScript(string $script[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $script : string
-
The script to inject.
- $arguments : array<string|int, mixed> = []
-
The arguments of the script.
Return values
mixed —The return value of the script.