Class JavascriptExecutorFacade
java.lang.Object
net.thucydides.core.webdriver.javascript.JavascriptExecutorFacade
Simple encapsulation of Javascript execution.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TdeserializeScriptResultAs(Class<T> classOfT, String script, Object... params) Executes the JavaScript code and deserializes the resulting object as a classOfT.<T> TdeserializeScriptResultAs(Class<T> classOfT, String script, Map<String, Object> injectedFields, Object... params) <T> List<T>deserializeScriptResultAsListOf(String script, Object... params) Executes the JavaScript code and deserializes the resulting object as a List.executeAsyncScript(String script) executeAsyncScript(String script, Object... params) executeScript(String script) Execute some Javascript in the underlying WebDriver driver.executeScript(String script, Object... params) protected com.google.gson.GsongetGson()voidregisterTypeAdapter(Type type, Object typeAdapter) Register a GSon type adaptor to use during the JSON deserialization
-
Constructor Details
-
JavascriptExecutorFacade
public JavascriptExecutorFacade(org.openqa.selenium.WebDriver driver) -
JavascriptExecutorFacade
public JavascriptExecutorFacade()
-
-
Method Details
-
getGson
protected com.google.gson.Gson getGson() -
registerTypeAdapter
Register a GSon type adaptor to use during the JSON deserialization- Parameters:
type-typeAdapter-
-
executeScript
Execute some Javascript in the underlying WebDriver driver.- Parameters:
script-
-
executeScript
-
executeAsyncScript
-
executeAsyncScript
-
deserializeScriptResultAs
public <T> T deserializeScriptResultAs(Class<T> classOfT, String script, Map<String, Object> injectedFields, Object... params) throws IllegalAccessException- Throws:
IllegalAccessException
-
deserializeScriptResultAs
public <T> T deserializeScriptResultAs(Class<T> classOfT, String script, Object... params) throws IllegalAccessException Executes the JavaScript code and deserializes the resulting object as a classOfT.- Parameters:
classOfT- Java Classscript- that returns JavaScript Objectparams- a map of parameters to inject into the deserialized object- Returns:
- deserialized as classOfT object
- Throws:
IllegalAccessException
-
deserializeScriptResultAsListOf
Executes the JavaScript code and deserializes the resulting object as a List.- Parameters:
script- that returns JavaScript Object- Returns:
- deserialized as List of classOfT
-