Skip to content

Instantly share code, notes, and snippets.

@JosXa
Created February 26, 2025 00:19
Show Gist options
  • Save JosXa/0c78ef6e956bb9f27c16a88a9680e960 to your computer and use it in GitHub Desktop.
Save JosXa/0c78ef6e956bb9f27c16a88a9680e960 to your computer and use it in GitHub Desktop.
import "@johnlindquist/kit"
import { Stagehand } from "@browserbasehq/stagehand"
metadata = {
name: "Stagehand Tests",
}
const key = await env("STAGEHAND_OPENAPI_API_KEY", { hint: "OpenAPI API Key" })
const stagehand = new Stagehand({
apiKey: key,
env: "LOCAL",
modelName: "gpt-4o",
})
await stagehand.init()
await hide()
const page = stagehand.page
await stagehand.page.goto("https://johnlindquist.github.io/kit-docs/")
await page.act("Go to the scriptlets page")
const answer = await page.extract("What does the `edit` directive do in scriptlets?")
await div(answer.extraction)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment