Skip to main content

Browser API

Browser API - browser automation

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

Quick Reference

MethodDescription
clickClicks an element in the browser.
fillFills a form field in the browser.
navigateNavigates the browser to a URL.
screenshotTakes a screenshot of the current browser viewport.
sendActionSends a generic browser action.

Methods


click

client.browser.click(data: BrowserClickRequest): Promise<BrowserActionResult>

Clicks an element in the browser.

Simulates a mouse click on the specified element, identified by a CSS selector or other locator strategy.

ParameterTypeRequiredDescription
dataBrowserClickRequestYesThe click request

Returns: Promise<BrowserActionResult> — A promise that resolves to the BrowserActionResult after the click

Full reference →


fill

client.browser.fill(data: BrowserFillRequest): Promise<BrowserActionResult>

Fills a form field in the browser.

Types text into the specified form field, replacing any existing content. The field is identified by a CSS selector or other locator strategy.

ParameterTypeRequiredDescription
dataBrowserFillRequestYesThe fill request

Returns: Promise<BrowserActionResult> — A promise that resolves to the BrowserActionResult after the fill

Full reference →


client.browser.navigate(data: BrowserNavigateRequest): Promise<BrowserActionResult>

Navigates the browser to a URL.

Loads the specified URL in the browser, waiting for the page to reach a ready state before resolving.

ParameterTypeRequiredDescription
dataBrowserNavigateRequestYesThe navigation request

Returns: Promise<BrowserActionResult> — A promise that resolves to the BrowserActionResult after navigation completes

Full reference →


screenshot

client.browser.screenshot(data?: BrowserScreenshotRequest): Promise<BrowserActionResult>

Takes a screenshot of the current browser viewport.

Captures the visible portion of the browser page as an image. Useful for visual verification and debugging during automated testing.

ParameterTypeRequiredDescription
dataBrowserScreenshotRequestNoOptional screenshot configuration

Returns: Promise<BrowserActionResult> — A promise that resolves to the BrowserActionResult containing the screenshot data

Full reference →


sendAction

client.browser.sendAction(data: BrowserSendActionRequest): Promise<BrowserActionResult>

Sends a generic browser action.

Executes an arbitrary browser action command. Use this for actions that don't have a dedicated convenience method, or for sending complex multi-step actions.

ParameterTypeRequiredDescription
dataBrowserSendActionRequestYesThe browser action payload describing the action to perform

Returns: Promise<BrowserActionResult> — A promise that resolves to the BrowserActionResult with the action outcome

Full reference →