Public Vars


js-execute (clj)



(js-execute driver script & args)
Return result of `driver` executing Javascript `script` with `args` synchronously in the browser. The script is sent as a string (can be multi-line). Under the hood, the browser wraps your code into a function, so avoid using the `function` clause at the top level. Don't forget to add `return <something>` operator if you are interested in a resulting value. You may access arguments through the built-in `arguments` pseudo-array from your code. You may pass any data structures that are JSON-compatible (scalars, maps, vectors). The result value is also returned trough JSON encode/decode pipeline (JS objects turn to Clojure maps, arrays into vectors and so on). - `args`: additional arguments for your script. Automatically converted to JSON. Example: ```Clojure (def driver (chrome)) (js-execute driver "return arguments[0] + 1;" 42) ;; => 43 ```