Browser Mutations
evaluate
Executes a JavaScript function or predicate within the page’s context and returns the result.
The function receives ‘arg’ as its first argument.
Example: evaluate(functionOrPredicate: "() => document.title")
Example with argument: evaluate(functionOrPredicate: "selector => document.querySelector(selector).innerText", arg: "#myElement")
Returns the JSON representation of the function’s return value.
Definition
Arguments
functionOrPredicate
: String!
A string containing the JavaScript function or predicate to execute.
Example: "() => ({ width: window.innerWidth, height: window.innerHeight })"
Example: "element => element.tagName"
(if an element is the context)
arg
: JSON
An optional JSON serializable argument to pass to the function.
Returns
The JSON
scalar type represents JSON values as specified by ECMA-404.