Playwright Browser Handle Dialog

To accept or dismiss browser dialogs like alert/confirm/prompt, handle the dialog so automation can continue.

X-School-Academy 2bb89d8 1.1 KB Updated

File contents

Usage

Use the MCP tool dev-swarm.request to send the payload as a JSON string:

{"server_id":"playwright","tool_name":"browser_handle_dialog","arguments":{}}

Tool Description

Handle a dialog

Arguments Schema

The schema below describes the arguments object in the request payload.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "accept": {
      "type": "boolean",
      "description": "Whether to accept the dialog."
    },
    "promptText": {
      "description": "The text of the prompt in case of a prompt dialog.",
      "type": "string"
    }
  },
  "required": [
    "accept"
  ],
  "additionalProperties": false
}

Background Tasks

If the tool returns a task id, poll the task status via the MCP request tool:

{"server_id":"playwright","method":"tasks/status","params":{"task_id":"<task_id>"}}

X-School-Academy/ai-dev-swarm/tree/main/dev-swarm/mcp-skills/playwright-browser-handle-dialog commit 2bb89d8828

Frequently asked questions

npx skillmds add x-school-academy/playwright-browser-handle-dialog