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 manage browser tabs, including listing, creating, switching, and closing tabs.

Methods

tabs

Returns information about all open tabs in the browser context.
await opensteer.tabs(): Promise<TabInfo[]>
TabInfo[]
array
Array of tab information objects

Example

import { Opensteer } from 'opensteer'

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

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

const tabs = await opensteer.tabs()
console.log(`Open tabs: ${tabs.length}`)
tabs.forEach(tab => {
  console.log(`[${tab.index}] ${tab.title} - ${tab.url} ${tab.active ? '(active)' : ''}`)
})

await opensteer.close()

newTab

Creates a new tab and optionally navigates to a URL.
await opensteer.newTab(url?: string): Promise<TabInfo>
url
string
Optional URL to navigate to in the new tab
TabInfo
object
Information about the newly created tab

Example

import { Opensteer } from 'opensteer'

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

// Create a blank tab
const blankTab = await opensteer.newTab()

// Create a tab with a URL
const tab = await opensteer.newTab('https://example.com')
console.log(`Created tab ${tab.index}: ${tab.title}`)

await opensteer.close()

switchTab

Switches to a tab by index.
await opensteer.switchTab(index: number): Promise<void>
index
number
required
Zero-based index of the tab to switch to

Example

import { Opensteer } from 'opensteer'

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

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

// Switch back to first tab
await opensteer.switchTab(0)

await opensteer.close()

closeTab

Closes a tab by index. If no index is provided, closes the current active tab.
await opensteer.closeTab(index?: number): Promise<void>
index
number
Optional zero-based index of the tab to close. If not provided, closes the active tab

Example

import { Opensteer } from 'opensteer'

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

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

// Close the second tab
await opensteer.closeTab(1)

// Close the current active tab
await opensteer.closeTab()

await opensteer.close()

TabInfo Type

Tab information is represented using the TabInfo type:
interface TabInfo {
  index: number
  url: string
  title: string
  active: boolean
}
index
number
Zero-based index of the tab
url
string
Current URL of the tab
title
string
Title of the page in the tab
active
boolean
Whether this tab is currently active

Build docs developers (and LLMs) love