This page is the focused guide for how to actually use Playwright in Tools.
If you want the broader feature overview, keep using the main page here:
There are three main Playwright workflows in this project:
Use this when you want to:
This is the right path for things like:
Use this when you want to:
This is normally done through browserbot.sh, except for the dedicated Socdemo playback path which now uses play/socdemo-play.sh as its direct runner.
Use this when you want to:
tests/e2eThis belongs to the dedicated Playwright E2E admin page and the normal Playwright test structure in the project root.
If you just want to get started quickly:
/admin/browser-automation/createexample-homechrome or chromiumstart_urlExample script:
await page.goto(input.url || 'https://example.com', { waitUntil: 'domcontentloaded' });
helpers.log('Loaded page', await page.title());
await helpers.screenshot('example-home.png');
return {
title: await page.title(),
url: page.url(),
};
Admin pages:
/admin/browser-automation/admin/browser-automation/playwrightOn the create/edit page, fill in:
facebook-postchrome, chromium, or edgeinputprofile_directorySet a persistent profile when you want to:
If you leave the field blank, Tools normally uses the script key itself as the default saved profile name.
Use headed mode when you:
Headless mode is better for stable already-prepared runs.
browserbot.shThe repo-root wrapper is the fastest way to use the same Playwright setup from shell.
bash browserbot.sh --list
bash browserbot.sh --key facebook-post
bash browserbot.sh --name "Facebook post"
bash browserbot.sh --key facebook-post --profile facebook-admin
bash browserbot.sh --key facebook-post --headed
bash browserbot.sh --key facebook-post --fresh-profile
That is the right choice when you do not want to reuse saved session state.
If you want to build the flow before saving the final script in the database, record/codegen first.
bash browserbot.sh --record --key facebook-post --start-url https://www.facebook.com/
This is useful when you want to:
bash browserbot.sh --open --browser chrome --profile facebook-admin --start-url https://www.facebook.com/
This opens the browser without playback and without forcing the codegen flow.
It is the right mode when you just want to:
If you already have one good base profile, you can clone it into a new profile instead of repeating the whole login flow.
bash browserbot.sh --clone-profile --copy-profile-from default --profile facebook-page-bot
bash browserbot.sh --open --profile facebook-page-bot --start-url https://www.facebook.com/
This is useful when:
default already contains expensive setup such as login, cookies, or extension configurationYour stored script runs inside an async function and receives:
pagecontextbrowserplaywrighthelpersinputhelpers.log(...parts)await helpers.screenshot('shot.png')await helpers.saveText('note.txt', '...')await helpers.saveJson('state.json', value)helpers.setOutput(value)await helpers.delay(ms)helpers.getEnv('NAME')await page.goto(input.url || 'https://example.com', { waitUntil: 'domcontentloaded' });
helpers.log('Title', await page.title());
await helpers.screenshot('page.png');
helpers.setOutput({
title: await page.title(),
url: page.url(),
});
return { ok: true };
The project's Playwright tests use:
playwright.config.tstests/e2estorage/playwright/profiles/<name>storage/playwright/Open:
/admin/browser-automation/playwrightFrom there you can:
base URLProject alias:
npm run test:e2e:codegen
Persistent helper:
bash bin/playwright-record-persistent.sh
Against an external environment:
PLAYWRIGHT_SKIP_WEBSERVER=true PLAYWRIGHT_BASE_URL=https://tools.tornevall.net bash bin/playwright-record-persistent.sh
cd automation/playwright
npm install
sudo bash bin/install-browserbot-stack.sh
That installer is now the canonical host-side setup entrypoint for this stack. In its current form it installs Node from NodeSource, filtered Linux browser dependencies, Xvfb, the Playwright package, and one project-local Playwright Chromium cache under storage/app/browser-automation/playwright-browsers.
Important details for the current runtime split:
browserbot.sh is still the general shell wrapper for stored scripts, --open, --record, profile cloning, and profile-seed export/import.play/socdemo-play.sh is now the special direct runner for the SocialGPT Socdemo playback flow./usr/bin/chromium-browser, and only uses Chrome when you explicitly request it.SOCDEMO_DISPLAY_MODE=headless is intentionally blocked for that extension-backed Socdemo playback path; the supported server-side model is still a headed browser inside Xvfb.sudo bash bin/install-browserbot-stack.sh
input simple and readableStart by checking:
start_urlprofile_directory--fresh-profile when you really want saved session reuseIf you want one slightly more realistic flow without starting too big:
--open or --record