Closer to the Metal: Leaving Playwright for CDP

browser-use.com

94 points by gregpr07 4 hours ago


dataviz1000 - 3 hours ago

I made this comment yesterday but really applies to this conversation.

> In the past 3 weeks I ported Playwright to run completely inside a Chrome extension without Chrome DevTools Protocol (CDP) using purely DOM APIs and Chrome extension APIs, I ported a TypeScript port of Browser Use to run in a Chrome extension side panel using my port of Playwright, in 2 days I ported Selenium ChromeDriver to run inside a Chrome Extension using chrome.debugger APIs which I call ChromeExtensionDriver, and today I'm porting Stagehand to also run in a Chrome extension using the Playwright port. This is following using VSCode's core libraries in a Chrome extension and having them drive a Chrome extension instead of an electron app.

The most difficult part is managing the lifecycle of Windows, Pages, and Frames and handling race conditions, in the case of automating a user's browser, where, for example, the user switches to another tab or closes the tab.

ipsum2 - 37 minutes ago

Nice thorough write up, I've had my share of annoyances with playwright for automating some menial tasks due to being blocked by captcha or other waf (I'm just logging into my own accounts and scraping my account balance, nothing nefarious), I'll try out pydoll or your library next time.

steveklabnik - 3 hours ago

Describing "2011–2017" as "the dark ages" makes me feel so old.

There was a ton of this stuff before Chrome or WebKit even existed! Back in my day, we used Selenium and hated it. (I was lucky enough to start after Mercury...)

arm32 - 3 hours ago

Ah, yes, the classic "Playwright isn't fast enough so we're reinventing Puppeteer" trope. I'd be lying if I haven't seen this done a few times already.

Now that I got my snarky remark out of the way:

Puppeteer uses CDP under the hood. Just use Puppeteer.

benmmurphy - 2 hours ago

direct CDP has been used by the scraping community for a long time in order to have a cleaner browser environment that is harder to fingerprint. for example nodriver (https://github.com/ultrafunkamsterdam/nodriver) was started in Feb 2024 and I suspect this technique was popular before that project started.

spullara - 2 hours ago

this is exactly what I did when I wrote my first agent with scraping. later we switched to taking control of the users browser through a browser extension.

johnsmith1840 - 2 hours ago

Why not cdp snapshot?

aitchnyu - 23 minutes ago

Umm, will this run on Firefox too? They deprecated CDP and favors Webdriver Bidi.

patrickhogan1 - 2 hours ago

Selenium was very usable before 2011.

This post is like saying Grafana and not mentioning Nagios

Robdel12 - 2 hours ago

All of the approaches of driving the browser outside of the browser is going to be slow (webdriver, playwright, puppeteer, etc).

Karma like approaches are where I’m at (execute in the browser)

- 2 hours ago
[deleted]
saberience - 2 hours ago

Talk about "not built here" mentality. This is a project doomed to failure. Using VC money to re-write better built software which has been around for years.

Good luck guys!