Skip to main content

Initialization

To initialize the SDK,create an instance of NfigClient with your API key. This connects your application to Nfig and allows interaction with the platform. During initialization, you can also specify the preferred browser mode (LOCAL or REMOTE) and enable debug mode to assist with troubleshooting.


Session Management

Note: A managed session in Nfig is active for 5 minutes in remote mode.

Creating a session

Use the createSession method to initialize a session. REMOTE Mode: Automate actions in a remote browser environment.Returns a preview URL for live monitoring. LOCAL Mode: Automate actions in a locally installed browser instance. Only supports Playwright for now.Allows passing the Page context initially, making it available throughout the session, or you can pass it with each method call.

Usage Example: REMOTE Mode


Usage Example: LOCAL Mode


Create Session Options

Auth Options in CreateSession

The AuthOptions provides configuration for authentication-related settings when creating a session using the createSession method. It allows specifying the authentication app and other parameters for customizing authentication behavior. The AuthOptions includes the following fields:

Supported Authentications and Enums

The following table lists the standard integrations that are currently supported:

Usage Example: REMOTE Mode with authentication and proxy


Ending a Session


EndSessionResponse

Note: Ending a session is a necessary action to avoid unexpected billing.

Exporting Session Video


ExportVideoResponse

Note: You will an email with the link to exported video.

Prompting

LOCAL mode can only take 1 precious action at a time.
Below is an example showing an Airbnb workflow using both modes.

Usage example: LOCAL mode

Usage example: REMOTE mode

SDK Methods


Act method

act method performs specific actions on a webpage.

Basic usage


Fallback Method

In LOCAL mode, act supports fallback method to try an action manually and use agent as a fallback method.

Parameters


Options


Ask method

ask method helps you retrieve information from a page in a structured way using Zod schemas.

Parameters


AskOptions