Class JavascriptExecutorFacade
- java.lang.Object
-
- net.thucydides.core.webdriver.javascript.JavascriptExecutorFacade
-
public class JavascriptExecutorFacade extends Object
Simple encapsulation of Javascript execution.
-
-
Constructor Summary
Constructors Constructor Description JavascriptExecutorFacade()
JavascriptExecutorFacade(org.openqa.selenium.WebDriver driver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
deserializeScriptResultAs(Class<T> classOfT, String script, Object... params)
Executes the JavaScript code and deserializes the resulting object as a classOfT.<T> T
deserializeScriptResultAs(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.Object
executeAsyncScript(String script)
Object
executeAsyncScript(String script, Object... params)
Object
executeScript(String script)
Execute some Javascript in the underlying WebDriver driver.Object
executeScript(String script, Object... params)
protected com.google.gson.Gson
getGson()
void
registerTypeAdapter(Type type, Object typeAdapter)
Register a GSon type adaptor to use during the JSON deserialization
-
-
-
Method Detail
-
getGson
protected com.google.gson.Gson getGson()
-
registerTypeAdapter
public void registerTypeAdapter(Type type, Object typeAdapter)
Register a GSon type adaptor to use during the JSON deserialization- Parameters:
type
-typeAdapter
-
-
executeScript
public Object executeScript(String script)
Execute some Javascript in the underlying WebDriver driver.- Parameters:
script
-
-
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
-
-