*** title: page.evaluate description: Run code inside the page context and return the serialized result. ------------------------------------------------------------------------------- `page.evaluate` is a browser runtime capability in the `page` namespace. ## Availability * Runtime: `browser` * Kind: `raw` * Category: `extraction` * Supported drivers: Playwright, Puppeteer, Stagehand ## SDK Surface * SDK path: `runtime.page.evaluate` * Async: Yes ## HTTP Surface * Transport: `workspace.execute(...)` * Call: `page.evaluate` * Long-running: No ## Reference Semantics * Requires refs: `page` ## Arguments | Argument | Type | Required | Description | | -------------- | -------------------- | -------- | ------------------------------------------- | | `pageFunction` | `function \| string` | Yes | Code to evaluate in the page. | | `arg` | `unknown` | No | Optional value passed to the page function. | ## Result * Type: `unknown` * Description: Serialized result of the evaluated code. ## SDK Example ```ts await runtime.page.evaluate(() => document.title); ``` ## HTTP Example ```json { "runtime": "crm", "steps": [ { "call": "page.evaluate", "args": [ "" ] } ] } ``` ## Related Capabilities * [`page.content`](../extraction/page-content) * [`locator.textContent`](../extraction/locator-text-content) ## Notes * Use driver-compatible argument and return types that can be serialized safely.