Browserflow
Search…
Run Script
Runs Javascript in the current page

Code

  • Any variable that begins with $ is automatically exported for use in other commands
    • e.g. const $meow = 3
  • Variables are serialized as JSON and thus support the following data types:
    • Primitives (number, string, boolean)
    • Arrays
    • JSON objects

Examples

Replacing Text

1
// Assume variable $numberOfComments has the value "12 comments"
2
// You want to extract just the numerical count
3
​
4
$numberOfComments = $numberOfComments.replace(" comments", "");
5
​
6
// $numberOfComments is now "12"
Copied!

Splitting Text

1
// Assume variable $location has the value "San Francisco, CA"
2
// You want to split up the city and the state
3
​
4
const [$city, $state] = $location.split(", ");
5
​
6
// $city is "San Francisco", $state is "CA"
Copied!

Execution context

The code is executed in the context of the current page which means that the page's DOM is accessible
​
Last modified 1mo ago
Copy link