────────────────────────────────────────
🟢 𝐖𝐡𝐚𝐭 𝐑𝐮𝐧𝐬 𝐖𝐡𝐞𝐧 𝐘𝐨𝐮 𝐨𝐫 𝐚𝐧 𝐀𝐈 𝐀𝐠𝐞𝐧𝐭 𝐓𝐲𝐩𝐞 𝐚 𝐂𝐨𝐦𝐦𝐚𝐧𝐝
1. You or your AI agent type a command in the terminal.
2. Playwright CLI reads it and opens the browser. It can run in headed mode (you see the window) or headless (no UI).
3. After the browser opens and the page loads, Playwright CLI takes a snapshot of the page. The snapshot is a small `.md` file with page details, including locators.
4. You or the AI agent read the snapshot and decide what to do next. If it shows a Login button, you see its accessibility ID (often something like `e10` or `e12`). Then you run a command such as `playwright-cli click e10` to click it.
That is the workflow in a nutshell:
Step 1 — load the web page
Step 2 — get a snapshot of it
Step 3 — act on the snapshot information
Playwright CLI does not replace Playwright, Selenium, or Cypress. It is a different tool that sits on top of them.
────────────────────────────────────────
👁 𝐇𝐞𝐚𝐝𝐞𝐝 𝐯𝐬 𝐇𝐞𝐚𝐝𝐥𝐞𝐬𝐬
Playwright CLI can open browsers in two modes: headed and headless.
Headed mode shows the browser on your screen. Use it when you set up the tool or when you need to see what happened.
Headless mode runs without a window. It is faster for repeat runs, but harder to watch.
Some failures only show up in one mode. If a command fails in headless, try headed once before you change the test.
────────────────────────────────────────
📌 Want hands-on practice with the AI workflows for test automation?
Join the AI AutoTest Live Workshop — live theory, practice, and real agent workflows for test automation.