Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/steerlabs/opensteer/llms.txt

Use this file to discover all available pages before exploring further.

Overview

OpenSteer provides methods to retrieve the current page state and capture screenshots.

Methods

state

Returns the current state of the page including URL, title, and HTML content.
await opensteer.state(): Promise<StateResult>
StateResult
object
Object containing current page state

Example

import { Opensteer } from 'opensteer'

const opensteer = new Opensteer()
await opensteer.launch()

await opensteer.goto('https://example.com')

const state = await opensteer.state()
console.log(`URL: ${state.url}`)
console.log(`Title: ${state.title}`)
console.log(`HTML length: ${state.html.length}`)

await opensteer.close()

screenshot

Captures a screenshot of the current page.
await opensteer.screenshot(options?: ScreenshotOptions): Promise<Buffer>
options
ScreenshotOptions
Optional configuration for the screenshot
options.fullPage
boolean
Whether to capture the full scrollable page. Default: false
options.type
'png' | 'jpeg'
Image format. Default: 'png'
options.quality
number
JPEG quality (0-100). Only applies when type is 'jpeg'. Default: 90
options.omitBackground
boolean
Whether to omit the default white background. Default: false
Buffer
Buffer
Image data as a Node.js Buffer

Example

import { Opensteer } from 'opensteer'
import { writeFile } from 'fs/promises'

const opensteer = new Opensteer()
await opensteer.launch()

await opensteer.goto('https://example.com')

// Capture viewport screenshot
const screenshot = await opensteer.screenshot()
await writeFile('screenshot.png', screenshot)

// Capture full page screenshot
const fullPage = await opensteer.screenshot({ fullPage: true })
await writeFile('fullpage.png', fullPage)

// Capture JPEG with custom quality
const jpeg = await opensteer.screenshot({
  type: 'jpeg',
  quality: 80
})
await writeFile('screenshot.jpg', jpeg)

await opensteer.close()

Types

StateResult

The state of the current page:
interface StateResult {
  url: string
  title: string
  html: string
}
url
string
Current URL of the page
title
string
Title of the page
html
string
HTML content of the page (cleaned snapshot)

ScreenshotOptions

Configuration options for screenshots:
interface ScreenshotOptions {
  fullPage?: boolean
  type?: 'png' | 'jpeg'
  quality?: number
  omitBackground?: boolean
}
fullPage
boolean
Capture the full scrollable page instead of just the viewport
type
'png' | 'jpeg'
Image format
quality
number
JPEG quality from 0 to 100. Ignored for PNG images
omitBackground
boolean
Hides default white background and allows capturing screenshots with transparency

BoundingBox

Represents the position and dimensions of an element:
interface BoundingBox {
  x: number
  y: number
  width: number
  height: number
}
x
number
X coordinate of the element in pixels
y
number
Y coordinate of the element in pixels
width
number
Width of the element in pixels
height
number
Height of the element in pixels

Build docs developers (and LLMs) love