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

1const page = await bctrl.tools.call("browser.pages.open", {
2 url: "https://example.com/checkout",
3}, { runtimeId: runtime.id });
4
5console.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

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

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

Next