Using the Puppeteer API

# Use the puppeteer API

Axiom is built on top of Google's Puppeteer framework. This means you can directly use some of the functions it provides in your own automations.

To use the puppeteer API, you need to first add a "Write Javascript" step - see here for more info on how to use this step.

In addition, you need to make sure that, if available, the "Run in app" toggle and checkbox are switched ON. This should only need to be done if you add your javascript as a sub-step of an an "Interact with a page's interface" step.

# Supported methods

The methods that are provided are part of the "page" API in Puppeteer; other functions are not available within Axiom.

View Google's documentation of this API here: class: Page (opens new window)

You do not have to instantiate a new page object when using these methods. Axiom automatically does this for you and passes a page object to the "Write javascript" step.

You can therefore use a method in the following way (using page.click as an example):

await page.click("#button")

# Iframe support

The methods provided essentially work the same as the puppeteer methods, but iframes are automatically supported within many methods.

This means you should not have to manually specify which frame to check. Axiom automatically searches all the frames on the page and tries the given instruction on all of them.