Move a Playwright script to bauta
Install bauta, make a persona, start the gateway, and change the one line of your script that connects.
A Playwright script keeps its code on bauta. What changes is how it connects: to a persona's endpoint on the gateway, instead of a browser it launches.
1. Install
# Linux and macOS
curl -fsSL https://bauta.dev/install.sh | bash# Windows (PowerShell)
irm https://bauta.dev/install.ps1 | iexOn a terminal the installer then runs bauta setup, which activates a free session on this machine and offers a
free account with GitHub.
2. Make a persona and start the gateway
bauta geo update
bauta persona new shop --from win-intel
bauta serve3. Change the line that connects
Before, the script launched its own browser:
browser = p.chromium.launch()On bauta, it connects to the persona:
browser = p.chromium.connect_over_cdp("http://127.0.0.1:9222/persona/shop")Everything after that line stays as it was: pages, selectors, waits and screenshots.
With Puppeteer
const browser = await puppeteer.connect({ browserWSEndpoint: "ws://127.0.0.1:9222/persona/shop" });Or let the package do it
pip install bautabrowser or npm install bautabrowser playwright-core, then launch() reaches the gateway, or
starts it, makes the persona and connects for you. The packages list its options.
Next
Playwright covers connecting in depth, and Proxies giving the persona a proxy.