chrome-devtools-cli
Skill này làm gì
Skill cho agent AI một công cụ dòng lệnh điều khiển Chrome qua DevTools. Skill dành cho người muốn tự động hóa tác vụ trình duyệt hoặc kiểm thử một trang web từ script.
Khi nào nên dùng
- ✓Khi bạn muốn một script mở trang web, nhấp nút hoặc điền biểu mẫu.
- ✓Khi bạn cần snapshot của trang để tìm các phần tử cho một bài kiểm thử tự động.
- ✓Khi bạn muốn kiểm tra cách một trang web hoạt động từ terminal.
Liên kết skill
https://github.com/humanlayer/humanlayer/blob/main/.claude/skills/chrome-devtools-cli/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Mở trang web của tôi trong Chrome, điền biểu mẫu liên hệ, rồi cho tôi biết nó đã được gửi chưa.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent chụp snapshot văn bản của trang để tìm từng phần tử, rồi nhấp hoặc gõ vào đó. Phiên trình duyệt vẫn mở giữa các lệnh, nên các bước có thể nối tiếp nhau.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
The chrome-devtools-mcp CLI lets you interact with the browser from your terminal.
Setup
Note: If this is your very first time using the CLI, see references/installation.md for setup. Installation is a one-time prerequisite and is not part of the regular AI workflow.
AI Workflow
- Execute: Run tools directly (e.g.,
chrome-devtools list_pages). The background server starts implicitly; do not runstart/status/stopbefore each use. - Inspect: Use
take_snapshotto get an element<uid>. - Act: Use
click,fill, etc. State persists across commands.
Snapshot example:
uid=1_0 RootWebArea "Example Domain" url="https://example.com/"
uid=1_1 heading "Example Domain" level="1"
Command Usage
chrome-devtools <tool> [arguments] [flags]
Use --help on any command. Output defaults to Markdown, use --output-format=json for JSON.
Input Automation (<uid> from snapshot)
chrome-devtools take_snapshot --help # Help message for commands, works for any command.
chrome-devtools take_snapshot # Take a text snapshot of the page to get UIDs for elements
chrome-devtools click "id" # Clicks on the provided element
chrome-devtools click "id" --dblClick true --includeSnapshot true # Double clicks and returns a snapshot
chrome-devtools drag "src" "dst" # Drag an element onto another element
chrome-devtools drag "src" "dst" --includeSnapshot true # Drag an element and return a snapshot
chrome-devtools fill "id" "text" # Type text into an input or select an option
chrome-devtools fill "id" "text" --includeSnapshot true # Fill an element and return a snapshot
chrome-devtools handle_dialog accept # Handle a browser dialog
chrome-devtools handle_dialog dismiss --promptText "hi" # Dismiss a dialog with prompt text
chrome-devtools hover "id" # Hover over the provided element
chrome-devtools hover "id" --includeSnapshot true # Hover over an element and return a snapshot
chrome-devtools press_key "Enter" # Press a key or key combination
chrome-devtools press_key "Control+A" --includeSnapshot true # Press a key and return a snapshot
chrome-devtools type_text "hello" # Type text using keyboard into a focused input
chrome-devtools type_text "hello" --submitKey "Enter" # Type text and press a submit key
chrome-devtools upload_file "id" "file.txt" # Upload a file through a provided element
chrome-devtools upload_file "id" "file.txt" --includeSnapshot true # Upload a file and return a snapshot
Navigation
chrome-devtools close_page 1 # Closes the page by its index
chrome-devtools list_pages # Get a list of pages open in the browser
chrome-devtools navigate_page --url "https://example.com" # Navigates the currently selected page to a URL
chrome-devtools navigate_page --type "reload" --ignoreCache true # Reload page ignoring cache
chrome-devtools navigate_page --url "https://example.com" --timeout 5000 # Navigate with a timeout
chrome-devtools navigate_page --handleBeforeUnload "accept" # Handle before unload dialog
chrome-devtools navigate_page --type "back" --initScript "foo()" # Navigate back and run an init script
chrome-devtools new_page "https://example.com" # Creates a new page
chrome-devtools new_page "https://example.com" --background true --timeout 5000 # Create new page in background
chrome-devtools new_page "https://example.com" --isolatedContext "ctx" # Create new page with isolated context
chrome-devtools select_page 1 # Select a page as a context for future tool calls
chrome-devtools select_page 1 --bringToFront true # Select a page and bring it to front
Emulation
chrome-devtools emulate --networkConditions "Offline" # Emulate network conditions
chrome-devtools emulate --cpuThrottlingRate 4 --geolocation "0,0" # Emulate CPU throttling and geolocation
chrome-devtools emulate --colorScheme "dark" --viewport "1920x1080" # Emulate color scheme and viewport
chrome-devtools emulate --userAgent "Mozilla/5.0..." # Emulate user agent
chrome-devtools resize_page 1920 1080 # Resizes the selected page's window
Performance
chrome-devtools performance_analyze_insight "1" "LCPBreakdown" # Get more details on a specific Performance Insight
chrome-devtools performance_start_trace true false # Starts a performance trace recording
chrome-devtools performance_start_trace true true --filePath t.gz # Start trace and save to a file
chrome-devtools performance_stop_trace # Stops the active performance t
Câu hỏi thường gặp
Tôi có cần thiết lập gì trước không?
Có. Cần cài đặt một lần trước lần sử dụng đầu tiên, như mô tả trong ghi chú thiết lập của skill.
Tôi có thể nhận kết quả dưới dạng dữ liệu không?
Có. Thêm tùy chọn đầu ra JSON sẽ trả về kết quả có cấu trúc thay vì Markdown.
Vì sao agent chụp snapshot trước?
Snapshot liệt kê từng phần tử với một ID, và agent cần ID đó để nhấp hoặc điền vào phần tử đó.
Chi tiết
Mô tả gốc của tác giả
Use this to skill to write shell scripts or run shell commands to automate tasks in the browser or otherwise use Chrome DevTools via CLI.
repo: humanlayer/humanlayer
Độ phổ biến
- Sao GitHub
- 13k
- Vị trí xếp hạng
- #11383
- Giấy phép
- Apache-2.0
- Cập nhật
- 31/10/2026
Bình luận
- …
Thêm skill từ kho mã này
asd-ste100
13kDạy agent của bạn viết lại tiếng Anh khó hiểu thành câu ngắn, mỗi câu một nghĩa, dễ đọc đối với con người và phần mềm khác.
better-github-skill
13kGiúp agent của bạn kiểm tra trạng thái pull request, đọc bình luận review và tìm lý do bản build CI thất bại, bằng các script GitHub có sẵn.
calldiff
13kGiúp agent của bạn so sánh chuỗi lời gọi hàm trong một codebase giữa hai phiên bản git, để review code thấy hành vi nào đã thay đổi.
effect-program-design
13kGiúp agent của bạn thiết kế và kiểm thử chương trình Effect v4 sẵn sàng cho production, với service rõ ràng, lỗi có kiểu, layer và xử lý tài nguyên an toàn.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.