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
Initialize with the official command
In your project directory, run the command from the official Playwright introduction:
npm init playwright@latestIt 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 testonce to confirm the example passes.Install only the browsers you need
According to the official browsers docs,
npx playwright installdownloads all the default browsers, and adding a name installs just one, for examplenpx 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.Headless and headed: when to use each
Tests run headless by default, which suits background and scheduled jobs. Adding
--headedopens 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.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.
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.
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.
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--allalso 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.
Related
- iMessage, AppleScript and Shortcuts on a rented Mac mini: it runs, but Apple decides about your account
- How to manage Node versions with nvm or fnm on a remote Mac mini
- Can an AI agent control the screen and browser on a rented Mac?
- Is the network exit on my rented Mac mini used only by me?
- How to schedule and auto-start jobs with user-level LaunchAgents on a remote Mac mini
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support