Skip to navigation

Open page

View as Markdown

Open a new page in an active browser Runtime. The returned page.id is the pageId used by the other browser page Tools and by Stagehand.

Open a page

const page = await bctrl.tools.call("browser.pages.open", {
url: "https://example.com/checkout",
}, { runtimeId: runtime.id });
console.log(page.id, page.url, page.title);

url is optional. If omitted, the Runtime opens a blank page. The Runtime must be active and use the browser runtime type.

Request parameters

ParameterTypeRequiredDescription
urlstringNoURL to open.

Response

FieldTypeAlways presentDescription
idPageIdYesIdentifier used by other browser page Tools.
urlstringYesCurrent page URL.
titlestringYesCurrent page title.
activebooleanYesWhether the page is active for subsequent browser work.

Run asynchronously

const call = await bctrl.tools.start("browser.pages.open", {
url: "https://example.com",
}, { runtimeId: runtime.id });
const page = await bctrl.toolCalls.result(call.id, {
waitSeconds: 30,
});

Use bctrl.toolCalls.get(call.id) to inspect progress or bctrl.toolCalls.cancel(call.id) to cancel an active call.

Next