Call JavaScript function
Call a function defined by the page (e.g. app.calculateTotal) with arguments and return its result.
Command in the Browser toolkit · id ooa.browser/call_javascript_function · 8 inputs (1 required), 1 output
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Function | String | Yes | Function name, reachable from window; dots for nested objects. | |
| Arguments | List | No | Arguments, in order (text, numbers, true/false, lists and dictionaries). | |
| Session | String | No | browser | Session name. |
| Return type | String | No | any | What the function returns: the result is checked and converted (none ignores it). |
| Window | Dictionary | No | Which window to act in. Leave empty to use the session's current tab. {"source": "browser", "title": "Invoice * - Shop", "title_match": "wildcard", "url": "...", "url_match": "contains", "browser": "edge"} switches to the first open tab whose title and/or address matches (also in attached browsers, and in one listening on port 9222); {"source": "variable", "variable": "session name"} uses that browser session; {"source": "application", "title": "..."} names a desktop window, which works only when it is a window of an attached browser. Matches: wildcard (default for the title), contains (default for the address), equals or regex; text matches ignore case. Values may use variables. | |
| Frame | Dictionary | No | Call the function inside this iframe instead of the main page: the captured iframe element. | |
| Argument types | List | No | The type of each argument, in order (G4): auto, text, number, boolean, list, dictionary or date; auto when left out. | |
| Wait up to (milliseconds) | Number | No | 60000 | How long to wait for the browser to answer (G4). |
Outputs
| Output | Type | What it is |
|---|---|---|
| result | Any | Value returned by the function (awaited when it returns a promise). |