AQI AIAQI AI Intelligence
⌕
Official documentationPartially tested · see scope

Use browser automation to test your own pages

Use Playwright locators, interactions and assertions on owned sites without presuming authority for external actions.

Last checked: Version: 1.64.1
A quick glossary

Models generate and reason. Agents use tools to work on tasks. A harness manages an agent’s environment. MCP connects tools and data. Skills are reusable task guidance.

Before you start

Prerequisites

This exercise uses Node.js, Playwright and Chromium only; no model, agent, account or API key.

Hardware

Hardware needs depend on software, model, quantization and task; no minimum or smooth-performance benchmark was run.

Deployment preference

Setup downloads Node/npm packages and a browser; example execution uses in-memory HTML without network requests. Reassess data flow when targeting a real site.

Implementation steps

  1. Prepare a separate practice folder

    Stage practice: Use an officially supported Node.js version; check node --version and npm --version. Enter a new empty folder under G:\code. In PowerShell set $env:PLAYWRIGHT_BROWSERS_PATH="G:\code\cache\ms-playwright" and $env:npm_config_cache="G:\code\cache\npm" first.

    Sources for this stage: Playwright official documentation
  2. Pin dependency and browser

    Stage practice: Run npm init -y, npm install --save-dev --save-exact @playwright/test@1.64.1, then npx playwright install chromium. Installation downloads software, not models. Keep package-lock.json; Linux system dependencies need separate official instructions, without automatic elevation.

    Sources for this stage: Browsers and cachePlaywright 1.64.1
  3. Save the original example below

    Stage practice: Create tests and save the code below as tests/aqi-first.spec.mjs. It creates an in-memory practice page without visiting sites, logging in or touching real forms. Its button changes ready to checked only.

    Sources for this stage: Writing testsPage.setContent
  4. Run and read a passing result

    Stage practice: Run npx playwright test tests/aqi-first.spec.mjs --workers=1 --reporter=list from the practice folder. Expect 1 passed: the heading, initial state and post-click state must all match, not merely open a browser.

    Sources for this stage: Command lineWriting tests
  5. Make it fail, then restore

    Stage practice: Change only the final assertion from checked to broken; rerun for 1 failed and a nonzero exit code. Read expected/received, restore checked and rerun. Missing browser: check this terminal’s cache variable and install the matching build. No tests: check folder and filename.

    Sources for this stage: Command line
  6. Move to your page and keep an exit

    Stage practice: After passing, create a separate test using page.goto for a page you may test; start with headings or visible text only. Write its own selectors and expectations. Stop with Ctrl+C; remove only your test to undo, not shared caches. Inspect logs, screenshots and traces before sharing page data.

    Sources for this stage: Writing testsCommand line

Commands and examples

Partially tested · see scope

import { test, expect } from '@playwright/test';

test('AQI first browser check', async ({ page }) => {
  await page.setContent(`<!doctype html><html lang="en"><meta charset="utf-8">
    <title>AQI practice</title><h1>AQI practice</h1>
    <p role="status">ready</p><button type="button">Check</button>
    <script>document.querySelector('button').addEventListener('click', () => {
      document.querySelector('[role="status"]').textContent = 'checked';
    });</script></html>`);
  await expect(page.getByRole('heading', { name: 'AQI practice' })).toBeVisible();
  await expect(page.getByRole('status')).toHaveText('ready');
  await page.getByRole('button', { name: 'Check', exact: true }).click();
  await expect(page.getByRole('status')).toHaveText('checked');
});

Validation checks

Change only the final assertion from checked to broken; rerun for 1 failed and a nonzero exit code. Read expected/received, restore checked and rerun. Missing browser: check this terminal’s cache variable and install the matching build. No tests: check folder and filename.

Recorded test results

The in-memory example passed on Windows headless Chromium / Playwright 1.64.1: pass, deliberate failure, restored pass. Fresh installation, real sites, AI control and other OSes were not tested.

Cost

Not verified

No paid model or API for this exercise; disk, downloads and a computer are needed. Hosting or added AI service costs are outside its scope.

Limits & boundaries

Do not bypass login, CAPTCHA or site policies; require human approval before payments, publishing or deletion.

Alternatives and next steps

If prerequisites are unmet, use a read-only or manual flow, then revalidate alternatives below without inheriting this compatibility status.

Original sources

Partially tested · see scope · JSON ↗

  1. Playwright official documentation ↗

    playwright.dev · · Official documentation

  2. Writing tests ↗

    playwright.dev · · Official documentation

  3. Browsers and cache ↗

    playwright.dev · · Official documentation

  4. Command line ↗

    playwright.dev · · Official documentation

  5. Page.setContent ↗

    playwright.dev · · Official documentation

  6. Playwright 1.64.1 ↗

    github.com · · Official documentation

Connected resources

Integration platformCost: Free software; check license and compute costs

Playwright

Browser automation and end-to-end testing for interactions on controlled pages.

Official documentation