uidebugagent

UI debugging and locator analysis — Use browser tools to inspect web/mobile applications, analyze DOM elements to determine stable locators, debug UI automation failures, and assist in generating Page Object classes.

Last repository push
GitHub Stars
156
Forks
59
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "uidebugagent" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-673faab3a5b68b64042276385fff7d3a290d53125b475c3dfc0741de236489ab. Verify the upstream source and version against https://github.com/anhtester/antigravity-testing-kit before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

UI debugging and locator analysis — Use browser tools to inspect web/mobile applications, analyze DOM elements to determine stable locators, debug UI automation failures, and assist in generating Page Object classes.

0 Downloads

Introduction source: third_party · anhtester · 0.0.1 Reference

SkillPi interpretation

Tasks
Skill inspect web/mobile applications bằng browser tools, phân tích DOM elements, xác định locators ổn định, debug UI automation failures, và hỗ trợ sinh Page Object classes.
Audience
Sử dụng skill này khi: Cần **khám phá UI** của một trang web/module mới Cần **tìm locator** cho element cụ thể Cần **debug** test automation fail do UI thay đổi Cần **verify** locator có hoạt động trên DOM thực tế không Cần **phân tích DOM** để hiểu cấu trúc UI (forms, tables, modals) Cần **capture evidence** (screenshot) cho test report Trigger keywords: "inspect UI", "tìm locator", "debug element", "mở browser xem", "kiểm tra DOM"
Inputs and outputs
Skill này có thể trả về: **Locator recommendations** — bảng primary + fallback cho mỗi element **DOM analysis** — cấu trúc element, attributes, state, hierarchy **Page Object suggestions** — class structure phù hợp cho trang đã inspect **Screenshots** — evidence visual tại các milestone **Debug findings** — nguyên nhân element not found / click fail + cách fix
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: UI Debug Agent
description: Skill inspect web/mobile applications bằng browser tools, phân tích DOM elements, xác định locators ổn định, debug UI automation failures, và hỗ trợ sinh Page Object classes.

UI Debug Agent

Description

Skill chuyên biệt giúp agent inspect ứng dụng web/mobile trực tiếp trên browser thật, phân tích DOM, thu thập locators ổn định, và debug các vấn đề UI automation.

Agent có thể:

  • Mở browser thật, navigate đến bất kỳ URL nào
  • Inspect DOM elements — xác định attributes, hierarchy, state
  • Thu thập locators ổn định cho Playwright, Selenium, Appium
  • Debug automation failures (element not found, click intercepted, timeout)
  • Capture UI state (snapshot, screenshot) để phân tích
  • Phân tích dynamic content, iframe, shadow DOM, SPA navigation

When to Use

Sử dụng skill này khi:

  • Cần khám phá UI của một trang web/module mới
  • Cần tìm locator cho element cụ thể
  • Cần debug test automation fail do UI thay đổi
  • Cần verify locator có hoạt động trên DOM thực tế không
  • Cần phân tích DOM để hiểu cấu trúc UI (forms, tables, modals)
  • Cần capture evidence (screenshot) cho test report

Trigger keywords: "inspect UI", "tìm locator", "debug element", "mở browser xem", "kiểm tra DOM"


MCP Command Sequence (BẮT BUỘC)

Khi sử dụng Playwright MCP để debug UI, LUÔN tuân theo thứ tự:

1. browser_navigate(url)           → Mở trang
2. browser_resize(1920, 1080)      → Desktop viewport
3. browser_wait_for(text/time)     → Chờ page load
4. browser_snapshot()              → Thu thập DOM (dùng để phân tích + tìm locator)
5. browser_click/type/hover(ref)   → Tương tác (nếu cần)
6. browser_take_screenshot()       → Chụp ảnh (evidence khi fail hoặc milestone)

Quy tắc quan trọng:

Quy tắc Chi tiết
KHÔNG navigate lại nếu đã ở đúng trang Tránh reload ngoài ý muốn
LUÔN resize ngay sau navigate browser_resize(1920, 1080) — đảm bảo desktop viewport
LUÔN wait trước khi snapshot Chờ page load hoàn tất
Dùng snapshot để phân tích Snapshot trả về accessibility tree — nhanh, chính xác, có ref để tương tác
Dùng screenshot để báo cáo Screenshot là hình ảnh — dùng khi cần evidence visual

Snapshot vs Screenshot

browser_snapshot browser_take_screenshot
Trả về Accessibility tree (text + ref IDs) Hình ảnh (PNG/JPEG)
Mục đích Phân tích DOM, tìm locator, xác định element Visual evidence, báo cáo, debug layout
Khi nào dùng ⭐ Luôn dùng trước khi tương tác Chỉ khi fail hoặc milestone quan trọng
Có ref để interact ✅ Có — dùng ref để click/type/hover ❌ Không — chỉ là hình ảnh
Tốc độ Nhanh Chậm hơn

Quy tắc: Ưu tiên snapshot cho phân tích, dùng screenshot cho evidence.


Quy trình Inspect UI

1. Mở & Chuẩn bị trang

browser_navigate → URL target
browser_resize → 1920 × 1080
browser_wait_for → chờ indicator page đã load (text hoặc thời gian)

Nếu trang yêu cầu đăng nhập:

  • Hỏi user credentials HOẶC dùng fixture sẵn có trong project
  • KHÔNG đọc file .env trực tiếp (quy tắc bảo mật)

2. Thu thập DOM Structure

browser_snapshot → accessibility tree

Từ snapshot, xác định:

  • Các element chính: buttons, inputs, links, headings, tables
  • Attributes quan trọng: role, name, label, placeholder, testid
  • Hierarchy: parent → child relationships
  • State: visible, enabled, disabled, checked, expanded

3. Xác định Locators

Với mỗi element cần locator, áp dụng priority order theo framework:

Playwright:

Priority Locator Ví dụ Khi nào dùng
1 ⭐ getByRole() getByRole('button', {name: 'Submit'}) Element có role + accessible name rõ ràng
2 getByLabel() getByLabel('Email') Form input có label
3 getByPlaceholder() getByPlaceholder('Enter email') Input có placeholder, không có label
4 getByText() getByText('Welcome back') Text content unique
5 getByTestId() getByTestId('submit-btn') Element có data-testid attribute
6 CSS page.locator('.submit-button') Không có semantic option nào phù hợp
7 XPath page.locator('//div[@class="x"]') Last resort — tránh dùng

Selenium:

Priority Locator Ví dụ
1 ⭐ By.id() By.id("email")
2 By.cssSelector("[data-testid]") By.cssSelector("[data-testid='submit']")
3 By.name() By.name("username")
4 By.cssSelector() By.cssSelector(".login-form button")
5 By.xpath() By.xpath("//button[text()='Login']")

Appium (Mobile):

Priority Locator Ví dụ
1 ⭐ Accessibility ID MobileBy.accessibilityId("loginButton")
2 ID (resource-id) MobileBy.id("com.app:id/login_btn")
3 Name MobileBy.name("Login")
4 XPath (relative) MobileBy.xpath("//android.widget.Button[@text='Login']")

4. Verify Locator

Sau khi xác định locator, bắt buộc verify trên DOM thực tế:

browser_snapshot → tìm element bằng ref
browser_click/type(ref) → thử tương tác
browser_snapshot → xác nhận kết quả

Locator được chấp nhận khi:

  • [ ] Unique trên page (chỉ match 1 element)
  • [ ] Ổn định qua nhiều lần reload
  • [ ] Không chứa dynamic class (css-xxx, sc-xxx, MuiXxx-root)
  • [ ] Không chứa positional xpath (//div[3]/button[2])
  • [ ] Không phụ thuộc auto-generated attribute

Xử lý tình huống đặc biệt

Trang yêu cầu đăng nhập

  • Dùng fixture login sẵn có trong project hoặc hỏi user credentials
  • KHÔNG đọc .env trực tiếp
  • Sau khi login, navigate đến trang cần inspect

Modal / Dialog / Popup

  • Modal thường là overlay trên page chính
  • browser_snapshot sẽ thấy modal content trong accessibility tree
  • Tương tác với modal elements bằng ref từ snapshot
  • Chờ modal animation hoàn thành trước khi interact

Iframe

  • browser_snapshot có thể không thấy content trong iframe
  • Dùng browser_evaluate để switch vào iframe:
    () => document.querySelector('iframe').contentDocument.body.innerHTML
  • Hoặc dùng Playwright frame locator: page.frameLocator('#iframe-id')

Shadow DOM

  • Playwright locator() tự động pierce shadow DOM
  • Selenium cần shadowRoot.findElement()
  • browser_snapshot có thể thấy shadow DOM content tùy MCP version

Dynamic Content (SPA / AJAX)

  • Chờ content load bằng browser_wait_for(text) trước khi snapshot
  • Nếu content load lazy → scroll xuống trước, rồi snapshot
  • Nếu content thay đổi theo thời gian → chụp snapshot nhiều lần

Tables / Lists (nhiều elements lặp)

  • Xác định pattern locator cho row/cell
  • Dùng nth() hoặc filter() để target element cụ thể
  • Ví dụ Playwright: page.getByRole('row').filter({hasText: 'John'}).getByRole('button', {name: 'Edit'})

Element bị che (Overlay / Toast)

  • Kiểm tra z-index, opacity, visibility trong DOM
  • Chờ overlay biến mất: browser_wait_for(textGone: 'Loading...')
  • Nếu toast notification che button → chờ toast timeout

Anti-Patterns (FORBIDDEN)

❌ Sai ✅ Đúng Lý do
Đoán locator từ tên tính năng Inspect DOM thực tế rồi mới lấy locator Locator chính xác 100%
Dùng screenshot để chọn locator Dùng snapshot (accessibility tree) Snapshot có ref, screenshot thì không
Copy locator từ code cũ không verify Luôn verify locator trên browser hiện tại DOM có thể đã thay đổi
Dùng dynamic class .css-1abc Dùng role/label/testid Dynamic class thay đổi mỗi build
Dùng positional xpath //div[3] Dùng relative xpath hoặc CSS Positional xpath dễ vỡ
Chụp screenshot liên tục Chỉ screenshot khi fail hoặc milestone Tốn resource, chậm
Navigate lại khi đã ở đúng trang Chỉ navigate khi cần đổi URL Tránh reload không cần thiết

Output

Skill này có thể trả về:

  • Locator recommendations — bảng primary + fallback cho mỗi element
  • DOM analysis — cấu trúc element, attributes, state, hierarchy
  • Page Object suggestions — class structure phù hợp cho trang đã inspect
  • Screenshots — evidence visual tại các milestone
  • Debug findings — nguyên nhân element not found / click fail + cách fix

Rules References

Agent PHẢI tuân thủ các rules chi tiết:

  • .agent/rules/locator_strategy.md — Master locator priority map
  • .agent/rules/playwright_rules.md — Playwright browser setup and locator rules
  • .agent/rules/selenium_rules.md — Selenium locator and wait rules
  • .agent/rules/appium_rules.md — Appium mobile locator rules
  • .agent/rules/automation_rules.md — General automation best practices

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 直接解决UI自动化测试中的核心痛点:元素定位、调试失败、生成Page Object
  • 提供详细的Playwright/Selenium/Appium定位器优先级策略
  • 覆盖多种特殊场景处理:iframe、shadow DOM、动态内容、modal等
Trigger Precision85/100

Areas to improve

  • description写错位置 Reported severity: Minor

    顶层frontmatter中description为空,但skill_body内部有实质描述内容

    Recommendation: 将description内容移至顶层frontmatter,保持结构规范

Highlights

  • 触发词覆盖全面,包含'inspect UI'、'tìm locator'、'debug element'等多种变体
  • 边界清晰,明确区分了不同使用场景
Structure and Standards95/100

Highlights

  • 结构完整,Phase/步骤清晰,有详细流程图
  • 包含完整的MCP命令序列和最佳实践规则
  • 提供了丰富的示例和对比表格
  • 文档组织良好,易于理解和执行
Execution Reliability90/100

Highlights

  • 工具使用规范明确,参数正确
  • 覆盖主要异常场景和特殊处理
  • 遵循最佳实践,有确认机制
  • 提供了详细的验证流程和反模式指南
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.