Show HN: Stagehand – an open source browser automation framework powered by AI

hackgician | 326 points

This looks awesome.

What I would love to see either as something leveraging this, or built in to this, is if you prompt stagehand to extract data from a page, it also returns the xpath elements you'd use to re-scrape the page without having to use an LLM to do that second scraping.

So basically, you can scrape new pages never before seen with the non-deterministic LLM tool, and then when you need to rescrape the page again to update content for example, you can use the cheaper old-school scraping method.

Not sure how brittle this would be both going from LLM version to xcode version reliably, or how to fallback to the LLM version if your xcode script fails, but overall conceptually, being able to scrape using the smart tools but then building up basically a library of dumb scraping scripts over time would be killer.

dchuk | 6 months ago

This looks very cool and makes a lot of sense, except for the idea that it should take the place of Playwright et al.

Personally I'd love to use this as an intermediate workflow for producing deterministic playwright code, but it looks like this is intended for running directly.

I don't think I could plausibly argue for using LLMs at runtime in our test suite at work...

mpalmer | 6 months ago

This looks really cool, thanks for sharing!

I recently tried to implement a workflow automation using similar frameworks that were playwright or puppeteer based. My goal was to log into a bunch of vendor backends and extract values for reporting (no APIs available). What stopped me entirely were websites that implemented an invisible captcha. They can detect a playwright instance by how it interacts with the DOM. Pretty frustrating, but I can totally see this becoming a standard as crawling and scraping is getting out of control.

asar | 6 months ago

My kneejerk reflex: "create-browser-app" is a very generic name, should just have called it "stagehand"

z3t4 | 6 months ago

I've been playing around with Stagehand for a minute now, actually a useful abstraction here. We build scrapers for websites that are pretty adversarial, so having built in proxies and captcha is delightful.

Do you guys ever think you'll do a similar abstraction for MCP and computer use more broadly?

sparab18 | 6 months ago

Can the script be compiled into actual DOM operations so that we don't need LLM for every run?

xingwu | 6 months ago

Cool! Before building a full test platform for testdriver.ai we made a similar sdk called Goodlooks. It didn't get much traction, but will leave it here for those interested: https://github.com/testdriverai/goodlooks

tomatohs | 6 months ago

Have been on the Slack for a while and this crew has had an insane product velocity. Excited to see where it goes!

zanesabbagh | 6 months ago

Can it be adapted to use ollama? Seems like a good tool to setup locally as a navigation tool.

pryelluw | 6 months ago

Hey Anirudh, Stagehand looks awesome, congrats. Really love the focus on making browser automations more resilient to DOM changes. The act, extract, and observe methods are super clean.

You might want to check out Lightpanda (https://github.com/lightpanda-io/browser). It's an open-source, lightweight headless browser built from scratch for AI and web automation. It's focused on skipping graphical rendering to make it faster and lighter than Chrome headless.

fbouvier | 6 months ago

Does this open up the possibility of automating an existing open browser tab? (Instead of a headless or specifically opened instance of chrome?)

bluelightning2k | 6 months ago

wow. It's like cursor vs vscode movement but for browser automation and scrapping. Kudos to the author. Are there any other similar tools?

jerrygoyal | 6 months ago

People must be excited for this since a lot of people are commenting for the first time in months or years to say how much they love it. Some people liked it so much they commented for the first time ever to say how great it is.

CyberDildonics | 6 months ago

Looks interesting. I know about the similar project - https://zerostep.com. Is it basically the same?

vitalets | 6 months ago

Does it operate by translating your higher level AI methods into lower level Playwright methods, and if so is it possible to debug the actual methods those methods were translated to?

Also is there some level of deterministic behavior here or might every test run result in a different underlying command if your wording isn’t precise enough?

jsdalton | 6 months ago

Cool to see another open source AI browser testing project! There’s a couple of others I’ve heard of as well:

Skyvern: https://github.com/Skyvern-AI/skyvern

Shortest: https://github.com/anti-work/shortest

I’d love to hear what makes Stagehand different and pros/ cons.

Of course, I have no complaints to see more competition and open source work in this space. Keep up the great work!

jameslk | 6 months ago

I’m curious how this compares to playwrights already built in codegen:

https://playwright.dev/docs/codegen-intro

Is a chat bot easier to reiterate a test?

righthand | 6 months ago

Congratulations. This is super cool.

I often thought E2E testing should be done with AI. What I want is that the functionality works (e.g.: login, then start an assignment) without the need to change the test each time the UI changes.

BrandiATMuhkuh | 6 months ago

cool extension to playwright! how effective are the ai methods in handling dynamic ui changes?

fasten | 6 months ago

Any attempt on doing something similar but as a browser extension?

owebmaster | 6 months ago

The easiest way to programmatically browse the web!!

arvindsubram | 6 months ago

[dead]

fredtalty5 | 6 months ago

[dead]

TibbityFlanders | 6 months ago