API functions

Each API function is an async function written in typescript. As an input, it user-passed and runtime params and returns a json object. Here is it what you get when you create a new API file:

// Standard playwright BrowserContext and Page
import { BrowserContext, Page } from "@intuned/playwright-core";

// a Utility function to extend the playwright page with the Intuned Helpers
import { extendPlaywrightPage } from "@intuned/sdk/playwright";

interface Params {
  // Add your params here
}

export default async function handler(
  params: Params,
  _playwrightPage: Page,
  context: BrowserContext
) {
  const page = extendPlaywrightPage(_playwrightPage);

  // Add your code here

  return {};
}
params
object

The input of the API request sent to the API as json.

_playwrightPage
Page (Playwright)

A standard playwright page object.

context
BrowserContext (Playwright)

A standard Playwright browser context object.

extendPlaywrightPage

The extendPlaywrightPage method extends the playwright page with helpers from `@intuned/sdk. These helpers facilitate faster and more reliable browser automation. For more information, please refer to the Automation SDKs reference.

Result

The result can be any serializable JSON object, and will be returned to the API consumer. If the result is not serializable, the function will throw an error.