---
name: automated-playwright-test-repair-agent
description: "Diagnoses failed Playwright browser tests by inspecting the DOM and logs, formulates updated selectors or navigation logic, and drafts a repair pull request. Use when an end-to-end test fails with an uncaught error."
license: CC-BY-4.0
compatibility: "Needs access to: Browser, GitHub, Terminal."
metadata:
  author: "BotBento Editorial"
  version: "2026-10-16"
  source: "https://botbento.com/usecases/automated-playwright-test-repair-agent/"
  kind: workflow
  hermes:
    tags: ["playwright", "testing", "browser", "ci", "debugging"]
    category: coding
    requires_toolsets: ["browser", "terminal"]
---
# Automated Playwright Test Repair Agent

Diagnose broken browser automation scripts and draft pull requests with updated selectors

## When to use

When browser end-to-end tests fail due to UI shifts or altered selectors, this bot inspects the DOM state of the failure, identifies broken locators, tests revised automation logic, and prepares a pull request with the corrective patches.

## Inputs

- `failure_stack_trace`: Stack trace from the browser automation test run that threw an uncaught error.
- `page_session`: Browser page session and DOM state captured at the point of failure.
- `test_run_logs` (optional): Terminal logs from the test run used to examine the failure context.

## Steps

1. When something happens: Test execution failure trigger (An uncaught error during a browser automation test run.)
2. Inspect DOM and update selectors
3. Draft repair PR for review

## Instructions

When a browser automation script throws an uncaught error during test runs, inspect the page session and failure stack trace. Use the terminal to examine logs, verify altered DOM elements in the browser, and formulate updated selectors or navigation logic. Test the proposed changes locally. Once verified, prepare a pull request containing the script fix on GitHub, but always require explicit user approval before pushing commits or submitting the pull request.

## Approvals

- Pushing commits requires explicit user approval.
- Submitting the pull request requires explicit user approval.

## Output

Draft pull request containing the verified script fix and updated selectors for review. (format: pull_request)

## Source

Summarized in our own words from [Show HN: Libretto PR agents – Automatically fix failing playwright scripts](https://news.ycombinator.com/item?id=48939710) (Hacker News, checked 2026-10-15). Any results described there are the authors’ own.

From the BotBento use-case directory: https://botbento.com/usecases/automated-playwright-test-repair-agent/. Licence: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
