User Tools

Site Tools


token:FrontBrowserJavaScript

**This is an old revision of the document!**

FrontBrowserJavaScript (v8+) Token

The FrontBrowserJavaScript token (and related SafariJavaScript and ChromeJavaScript tokens) provides a quick and simple means to execute one line of JavaScript in a Web Browser and return the results to an action like the Set Variable to Text action.

The execution time is limited (v11.0+) to half a second, so for longer or more complex JavaScript code, use the Execute JavaScript in Front Browser action instead.

The front browser will be the most recently front Safari-like or Chrome-like web browser.

Format

Like all Tokens, this token uses % to denote it as a token, and to separate the root token from its parameter, a single line of JavaScript:
%FrontBrowserJavaScript%<One Line of JavaScript>%

Examples

1. Get All Text on Web Page

%FrontBrowserJavaScript%document.body.innerText;%

2. Get Full Page HTML

%FrontBrowserJavaScript%document.getElementsByTagName("html")[0].outerHTML;%

3. Get Text Identified by HTML tag and class

%FrontBrowserJavaScript%document.querySelector('div.someclassname').innerText;%

See Also

Tokens

token/FrontBrowserJavaScript.1694579306.txt.gz · Last modified: 2023/09/13 00:28 by peternlewis