Bring your own browser?
I have my own browser instance running that I would like Stagehand to attach to.
Is this possible?
can you say more? What kind of browser and where is it running? we do support a local mode currently.
+1 for this one. I wish there was an option to pass in a custom Playwright Browser through the config
Use cases:
- To be able to attach cookies / browser extensions
- To be able to use custom chrome builds
- To be able to use firefox / safari
At work I am forced to use a corporate laptop, on which all the browsers are blocked except for chrome on a specific path Hence, playwright does not work, unless I specify the path to the chrome manually
can you say more? What kind of browser and where is it running? we do support a local mode currently.
I have a Chromium browser running in a docker container I would like stagehand to attach to.
Hey!
Multiple browsers is unfortunately not on the roadmap as of now. We want Stagehand to be really really good on Chrome, and our roadmap is actually more likely to include performance upgrades for users running on Chrome at the cost of degraded support for Firefox/Safari.
If you're interested in browser customization, I highly recommend checking out Browserbase for stuff like custom contexts and extensions while we work on implementing those features natively in Stagehand
@kamath He meant attaching to an existing browser session.
yeah ifi have a chromium running on my own server could i point stagehand at that wss:// browser CDP protocol and control it the same way, it shoudl work theoretically
I would like to do something like this
import { chromium } from 'playwright-extra'
const browser = await chromium.launch()
const context = await browser.newContext({
// custom state
storageState: loadStorageState(),
})
const stagehand = new Stagehand({
...StagehandConfig,
// Use your own context
context,
})
I'd really like to be able to connect to the local Chrome on my Mac via CDP, too. This is so I can re-use the cookies/localstorage in there
So I'd log into a bunch of systems in Chrome (including "hard to log into" ones) and then run the stagehand program
Not being able to pass arguments to the Playwright context (i.e. browser.newContext({...}) is a major blocker.
This prevents Stagehand from being used in real-world projects that depend on options in Playwright’s BrowserContextOptions (docs).
I like @miekassu’s suggestion of passing through an existing context.
If that’s not feasible, could you add Playwright’s BrowserContextOptions to StagehandConfig so they can be passed to the internally created context?
+1 for Chrome CDP support
We currently use tools to manage multiple browser "profiles" (each with their own cookies and storage) that are accessible via CDP.
Currently we maintain Playwright automation scripts for these profiles and we'd like to use Stagehand to simplify our automation workflow.
Hi all! Copying over my comments from here:
- I think it's a totally fair call out that we expose less configurability for local than we should.
- Frankly, the reason for doing this is because the Stagehand team is quite small, and exposing configurations of the local browser introduce more variables for unreliability, so we're trying to be super thoughtful about what we add.
- The Browserbase browser enables more configurability, because it's much easier for us to debug issues that are reported.
- You always are welcome to maintain a fork of Stagehand. We're MIT licensed for a reason, and are very supportive of forks!
That all being said, I just opened https://github.com/browserbase/stagehand/pull/494 which should address some of the configurability feedback! I hope you can give it a try.
@pkiv does that PR address the ability to use a custom playwright context? I don't see it anywhere, but I could be missing something.
this is really important.
I'm using a self-hosted instance of https://github.com/browserless/browserless. Can it work with that?