Reference
SDK Methods
The public SDK surface centers on page lifecycle, DOM actions, extraction, network inspection, browser state, and runtime helpers.
SDK Methods
The SDK is intentionally small. The main class gives you page lifecycle, DOM actions, extraction, request discovery, browser state access, and a few runtime-level helpers.
Construction
import { Opensteer } from "opensteer";
const opensteer = new Opensteer({
workspace: "demo",
rootDir: process.cwd(),
engineName: "playwright",
browser: "persistent",
launch: {
headless: false,
executablePath: process.env.OPENSTEER_EXECUTABLE_PATH,
args: [],
timeoutMs: 30_000,
},
context: {
locale: "en-US",
timezoneId: "America/Los_Angeles",
viewport: { width: 1440, height: 900 },
humanize: true,
},
provider: {
mode: "local",
},
});
browser can also be:
"temporary"
or:
{
mode: "attach",
endpoint: "ws://127.0.0.1:9222/devtools/browser/...",
headers: { authorization: "Bearer ..." },
freshTab: true,
}
Lifecycle
| Method | Notes |
|---|---|
open(urlOrInput?) | Opens the session and optionally navigates |
info() | Returns current session info |
close() | Closes the active session |
disconnect() | Detaches without closing the session |
Pages
| Method | Notes |
|---|---|
listPages() | Lists open pages |
newPage(input?) | Opens a new page |
activatePage(input) | Switches the active page |
closePage(input?) | Closes a page |
goto(url, options?) | Navigates and can capture network traffic |
waitForPage(options?) | Waits for the next matching page |
JavaScript
| Method | Notes |
|---|---|
evaluate(scriptOrInput) | Runs JavaScript and returns the value |
addInitScript(scriptOrInput) | Injects a script before page scripts run |
DOM and extraction
| Method | Notes |
|---|---|
snapshot("action" | "extraction") | Returns the cleaned HTML string |
click(input) | Target exactly one of element, selector, or persist |
hover(input) | Same target model as click() |
input(input) | Same target model plus text and optional pressEnter |
scroll(input) | Same target model plus direction and amount |
extract(input) | extract({ schema }), extract({ persist, schema }), or extract({ persist }) |
Target shape:
{ element: number }
{ selector: string }
{ persist: string }
You must choose exactly one.
Network and fetch
| Method | Notes |
|---|---|
network.query(input?) | Queries saved network records from the active workspace or session scratch store |
network.detail(recordId, options?) | Reads one saved record and can include a transport probe |
fetch(url, options?) | Returns a standard Response |
Example:
await opensteer.network.query({ capture: "search" });
await opensteer.network.detail("rec_123", { probe: true });
queryNetwork(), waitForNetwork(), and waitForResponse() are not part of the Opensteer class.
Browser state
| Method | Notes |
|---|---|
cookies(domain?) | Returns a lightweight cookie jar |
storage(domain?, "local" | "session") | Returns a key/value map |
state(domain?) | Returns the broader browser state snapshot |
Cookie jar helpers:
const jar = await opensteer.cookies(".example.com");
jar.has("session");
jar.get("session");
jar.getAll();
jar.serialize();
Computer and instrumentation
| Method | Notes |
|---|---|
computerExecute(input) | Coordinate-based interaction and screenshots |
route(input) | Request interception when the runtime supports instrumentation |
interceptScript(input) | Script interception when the runtime supports instrumentation |
route() and interceptScript() are available on instrumentable runtimes such as local or cloud Playwright sessions. If the runtime does not support them, they throw a runtime-availability error.
Controllers
The SDK also exposes grouped controllers:
dom
await opensteer.dom.click({ persist: "search button" });
await opensteer.dom.input({ persist: "search input", text: "laptop" });
network
await opensteer.network.query({ capture: "search" });
await opensteer.network.detail("rec_123", { probe: true });
browser
await opensteer.browser.status();
await opensteer.browser.clone({
sourceUserDataDir: "/tmp/chrome-profile",
sourceProfileDirectory: "Default",
});
await opensteer.browser.reset();
await opensteer.browser.delete();
browser.status() is local-only. browser.clone(), browser.reset(), and browser.delete() also require a persistent workspace browser. In cloud mode all browser.* helpers throw.
