Home/Guides/How to set up Playwright for browser automation on a remote Mac mini

How to set up Playwright for browser automation on a remote Mac mini

Updated · airankrush

What this guide covers

When you finish, you can run tests headless, or watch a real browser execute your script in the remote desktop. You need: Node at the version the project requires, and a remote desktop.

Steps

  1. Initialize with the official command

    In your project directory, run the command from the official Playwright introduction:

    npm init playwright@latest

    It can create a new project or add Playwright to an existing one, and it downloads browsers as prompted. See that page for the system and Node version requirements. Run npx playwright test once to confirm the example passes.

  2. Install only the browsers you need

    According to the official browsers docs, npx playwright install downloads all the default browsers, and adding a name installs just one, for example npx playwright install webkit. Browsers are stored in ~/Library/Caches/ms-playwright, and each Playwright upgrade may download another set. The system dependency step in the docs that needs elevated privileges is aimed at Linux and is not needed on macOS.

  3. Headless and headed: when to use each

    Tests run headless by default, which suits background and scheduled jobs. Adding --headed opens a real browser window, and that needs a logged-in graphical desktop. A rented Mac is a whole machine with a real desktop, so once your account is logged in the condition is met, and you can connect to the remote desktop and watch it click. Use headed mode to debug selectors or to see which step of a verification flow gets stuck, and headless mode for everyday batch runs.

  4. Grant permissions when you need system-level control

    Playwright drives the browser through its own protocol and generally does not need the system's Accessibility permission. But if your flow also captures the whole screen, controls other apps or simulates system-level keyboard and mouse input, you have to open System Settings → Privacy & Security in the remote desktop and grant access to the relevant program. See screen control permissions. Permission prompts can only be clicked in the graphical interface; a script cannot click them.

  5. Understand how the public exit actually works

    This machine uses residential broadband in the United States. The broadband and the public exit may be shared with other machines, and it is not a fixed address. For automation this means: the source address a target site sees may not represent you alone, other people's traffic can affect how that address is treated, and the address may change. Testing your own site is no problem. If your scenario depends on a source-address allowlist, check with support before ordering. See the shared exit explained.

  6. Stay within the permitted uses

    The terms of use prohibit unauthorized scanning, harassing bulk messaging, and evading the security mechanisms of third-party platforms. When you access someone else's site, follow their terms of service and crawling rules, and keep the request rate under control. This is not only a compliance matter: the exit may be shared, so aggressive access can drag down other machines on the same exit, and it can also get your service suspended.

  7. Clean up old browsers and test artifacts

    The official docs state that Playwright automatically removes browser versions no installation references any more. To clean up by hand, use npx playwright uninstall; adding --all also removes those left behind by other installations. Also keep an eye on the directories for test reports, videos and trace files. With long-running scheduled jobs they grow faster than the browsers themselves, so write a script that deletes old files regularly.

FAQ

After I disconnect the remote desktop, can a headed script still run?

Disconnecting remote access does not log the remote desktop out, and programs carry on as they were. However, we have not verified how a headed browser behaves in every lock screen and display sleep state, so we suggest headless mode for long unattended jobs.

Can I use the Chrome installed on the machine instead of the bundled Chromium?

Playwright supports using an installed Chrome through channel: 'chrome', provided Chrome is already installed on this Mac. See the official browsers docs for how to write the config.

Can I use this machine to test how my service performs for visitors in the United States?

Yes. The machine is in the United States, so it suits checking how your own service behaves when accessed from a US residential network. See US network testing.

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All guides