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[]>
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>
Optional URL to navigate to in the new tab
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>
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>
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
}
Zero-based index of the tab
Title of the page in the tab
Whether this tab is currently active