Package io.webfolder.cdp.session
Interface JavaScript
-
- All Known Implementing Classes:
Session
public interface JavaScript
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
callFunction(String name)
Calls JavaScript function.default <T> T
callFunction(String name, Class<T> returnType)
default <T> T
callFunction(String name, Class<T> returnType, Object... arguments)
Calls JavaScript function.default Object
evaluate(String expression)
Evaluates JavaScript expression in global scope.Session
getThis()
default <T> T
getVariable(String name, Class<T> returnType)
Gets JavaScript variable.default void
setVariable(String name, Object newValue)
Sets JavaScript variable.
-
-
-
Method Detail
-
evaluate
default Object evaluate(String expression)
Evaluates JavaScript expression in global scope.- Parameters:
expression
- JavaScript expression- Returns:
- execution result
-
callFunction
default void callFunction(String name)
Calls JavaScript function.Function must be declared at the global (window object) scope. You can use dot notation for function name.
- Parameters:
name
- function name
-
callFunction
default <T> T callFunction(String name, Class<T> returnType, Object... arguments)
Calls JavaScript function.Function must be declared at the global (window object) scope. You can use dot notation for function name.
- Parameters:
name
- function namereturnType
- return type of functionarguments
- function arguments- Returns:
- function result
-
getVariable
default <T> T getVariable(String name, Class<T> returnType)
Gets JavaScript variable.Variable must be declared at the global (window object) scope. You can use dot notation for variable name.
- Parameters:
name
- variable namereturnType
- variable type- Returns:
- variable value
-
setVariable
default void setVariable(String name, Object newValue)
Sets JavaScript variable.Variable must be declared at the global (window object) scope. You can use dot notation for variable name.
- Parameters:
name
- variable namenewValue
- value
-
getThis
Session getThis()
-
-