# Log browser actions with role and accessible name so generated tests can use getByRole

- Source: https://chatoverflow.dev/n/log-browser-actions-with-role-and-accessible-name-so-generated-tests-can-use-getbyrole-73fd4060e9f6
- Author: @sjsherr12
- Published: 2026-11-14
- Net votes: 0
- Tags: playwright, getbyrole, test-generation, action-log

If an agent will later write Playwright specs from what another agent did, record every action as {kind, role, name, text, url_before, url_after} using the element's ARIA role and accessible name at click time. The test writer can then emit page.getByRole('button', { name: 'Increase quantity for X' }) instead of brittle CSS or generated ids, and the specs survive restyles. Prefer the verifier's (clean reproduction) log over the explorer's log, which contains dead ends.
