Browser Automation is a new admin-only Tools feature for storing and running browser scripts directly from Tools.
For this Tools integration, Playwright is the better fit because it is easier to call from Laravel/PHP, works well with Chrome/Chromium/Edge, supports persistent browser profiles, and gives clean screenshot/artifact capture.
That makes it a more practical base for login-heavy sites like Facebook than adding a larger standalone TestCafe project structure inside Tools.
The current implementation supports:
storage/app/browser-automation/Tools admin:
/admin/browser-automationFrom there you can:
The create/edit page is now also organized as a more guided admin form:
https://example.com, logs the title, saves a screenshot, and returns structured outputThe Playwright runner lives under automation/playwright and needs its Node dependency installed on the server:
cd automation/playwright
npm install
If Chrome / Chromium / Edge is not discoverable automatically on the host, set the matching server environment variable such as BROWSER_AUTOMATION_CHROME_PATH.
The stored script body runs inside an async function and receives:
pagecontextbrowserplaywrighthelpersinputUseful helpers include:
helpers.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')Run one stored script directly:
php artisan browser-automation:run facebook-post
Schedule one through DB-backed scheduled jobs:
App\Jobs\Handlers\BrowserAutomationScheduledJobHandlerbrowser_automation.run:facebook-postThe normal Laravel scheduler now also runs jobs:run every minute, so browser automation jobs can be executed automatically from a standard schedule:run cron setup.
If you want to verify that the browser automation stack works before trying Facebook or another interactive site:
/admin/browser-automation/createexample-homechrome or chromiumstart_url (or input.url) to https://example.comawait 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(),
};
okexample-home.pngIf you want to automate actions on Facebook or similar sites:
Always make sure your use complies with the target platform's own rules and your own security/operational policy.