DEDUPED Hot AI repos, turned into use cases Get 5 a day

How to drive Moli from Playwright over CDP with Moli

Run a local Moli server and control it from an existing Playwright script.

  • Research
  • Advanced
  • 30 minutes
  • From the README
  • Any agent

Who it is forA developer with an existing Playwright automation who wants a lighter browser backend, triggered by high memory use from a full Chromium install.

The problemChromium-based automation uses a lot of memory per session, and moving existing Playwright scripts to another browser usually means rewriting them.

The outcomeA Playwright script that loads a page and prints its body text through the Moli server, with no code changes beyond the connection.

What you need first

  • A computer running Linux, macOS, or Windows
  • Terminal access (PowerShell on Windows)
  • Permission to download and run the Moli installer from GitHub
  • A URL to fetch or test

Steps

  1. Install the Moli binary from the README installer.
  2. Run moli serve to start the automation server, which serves CDP, WebDriver Classic, and WebDriver BiDi on one endpoint.
  3. Install Playwright in your project with npm install playwright. (inferred, check the README)
  4. Run the README Playwright script that calls chromium.connectOverCDP("http://127.0.0.1:9222"), then page.goto and page.locator("body").innerText().

Prompt for your agent

Using the repo lexmount/moli, start the server with `moli serve` and connect Playwright to http://127.0.0.1:9222 with connectOverCDP. Navigate to <target-url> and print the body innerText. Verify that the printed text matches the visible text of the page.

Caveat. The README says DOM-first mode is the default and that geometry, coordinate input, and screenshots need `moli serve --layout`, so some Playwright calls will fail without that flag.

Share: X LinkedIn Hacker News Email Copy link

Disclaimer

Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page