Executes an asynchronous piece of JavaScript in the context of the currently selected frame or window.
Executes an asynchronous piece of JavaScript in the context of the currently selected frame or window.
Unlike executing synchronous JavaScript, scripts executed with this method must explicitly signal they are finished by invoking the provided callback. This callback is always injected into the executed function as the last argument.
The first argument passed to the callback function will be used as the script's result. This value will be handled as follows:
Script arguments must be a number, boolean, String, WebElement, or a List of any combination of these.
An exception will be thrown if the arguments do not meet these criteria.
The arguments will be made available to the JavaScript via the "arguments" variable. (Note that although this
behavior is specified by
Selenium's JavascriptExecutor Javadoc, it may still be possible for the underlying
JavascriptExecutor
implementation to return an objects of other types. For example,
HtmlUnit
has been observed to return a java.util.Map
for a Javascript object.)
the JavaScript to execute
the arguments to the script, may be empty
One of Boolean, Long, String, List, WebElement, or null (following Selenium's JavascriptExecutor Javadoc)
Executes JavaScript in the context of the currently selected frame or window.
Executes JavaScript in the context of the currently selected frame or window. The script fragment provided will be executed as the body of an anonymous function.
Within the script, you can use document
to refer to the current document.
Local variables will not be available once the script has finished executing, but global variables will.
To return a value (e.g. if the script contains a return statement), then the following steps will be taken:
Script arguments must be a number, boolean, String, WebElement, or a List of any combination of these.
An exception will be thrown if the arguments do not meet these criteria. The arguments will be made available
to the JavaScript via the "arguments" variable. (Note that although this behavior is specified by
Selenium's JavascriptExecutor Javadoc, it may still be possible for the underlying
JavascriptExecutor
implementation to return an objects of other types. For example,
HtmlUnit
has been observed to return a java.util.Map
for a Javascript object.)
the JavaScript to execute
the arguments to the script, may be empty
One of Boolean, Long, String, List or WebElement. Or null (following Selenium's JavascriptExecutor Javadoc)
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an exception.
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an exception.
the amount of time to wait for an asynchronous script to finish execution before throwing exception
This trait is part of the PageObject DSL.
This trait implements javascript commands.