Code snippets

The Write javascript step lets you extend axiom.ai with custom code. The snippets in this section have been tried and tested in real automations, and many came from user requests. They're split into two categories: standard JavaScript that runs against the page, and Puppeteer snippets that drive the browser through Puppeteer's API.

Snippet categories


Run in app


The Run in app toggle on the Write javascript step runs your code inside the desktop application instead of inside the page. This is required for any snippet that uses the Puppeteer API. It's also useful when:

  • You don't want your code to interact with the page's own scripts. Running in the page can trigger the page's event listeners or clash with its function and variable names.
  • You need access to Node.js APIs (the fs module, for example) that aren't available in a browser context.

There are trade-offs:

  • You can't access elements, functions, or variables from the page being automated.
  • Console output isn't visible during the run when Run in app is enabled.

Note: Run in app only works on desktop runs. Cloud runs always execute scripts in the page context.

Need help? Contact support or ask a question in our Reddit community.