Response mirrors Playwright’s Response interface and is returned from Stagehand navigation helpers such as page.goto(), page.reload(), page.goBack(), and page.goForward(). It provides a convenient way to inspect the HTTP metadata associated with a navigation, retrieve the response body on demand, and monitor when the underlying request finishes.Stagehand automatically returns null for navigations that do not yield a network request (for example data: URLs, about:blank, or same-document history changes), matching Playwright’s behaviour.
const response = await page.goto("https://example.com", { waitUntil: "networkidle",});if (!response) { throw new Error("Navigation did not produce a network response");}console.log("Status", response.status(), response.statusText());const body = await response.text();
When a navigation does not produce a response object you will receive null, allowing you to branch early:
Parses the response body as JSON. Throws if the body cannot be parsed or is not valid JSON.
All body helper calls (body(), text(), json()) only succeed once the browser reports the response body is available. Stagehand handles this timing automatically.
Resolves to null when the main navigation request completes successfully, or to an Error if Chrome reports Network.loadingFailed. This mirrors Playwright’s response.finished() contract and is especially helpful for catching late failures such as network resets or blocked responses.