page.evaluate

View as Markdown

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

ArgumentTypeRequiredDescription
pageFunctionfunction | stringYesCode to evaluate in the page.
argunknownNoOptional value passed to the page function.

Result

  • Type: unknown
  • Description: Serialized result of the evaluated code.

SDK Example

1await runtime.page.evaluate(() => document.title);

HTTP Example

1{
2 "runtime": "crm",
3 "steps": [
4 {
5 "call": "page.evaluate",
6 "args": [
7 "<function>"
8 ]
9 }
10 ]
11}

Notes

  • Use driver-compatible argument and return types that can be serialized safely.