Package io.webfolder.cdp.session
Interface JavaScript
- All Known Implementing Classes:
Session
public interface JavaScript
-
Method Summary
Modifier and TypeMethodDescriptiondefault 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 <T,
U> CompletableFuture<T> callPromise
(String name, Class<T> returnType, Object... arguments) Calls JavaScript Promise function.default Object
Evaluates JavaScript expression in global scope.getThis()
default <T> T
getVariable
(String name, Class<T> returnType) Gets JavaScript variable.default void
setVariable
(String name, Object newValue) Sets JavaScript variable.
-
Method Details
-
evaluate
Evaluates JavaScript expression in global scope.- Parameters:
expression
- JavaScript expression- Returns:
- execution result
-
callFunction
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
-
callFunction
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
-
callPromise
default <T,U> CompletableFuture<T> callPromise(String name, Class<T> returnType, Object... arguments) Calls JavaScript Promise 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
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
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()
-