chrome-cdp-cli 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -126,148 +126,148 @@ Examples:
126
126
  return [
127
127
  {
128
128
  name: 'cdp-cli',
129
- description: 'Chrome DevTools Protocol CLI 工具',
130
- instructions: `通过 Chrome DevTools Protocol 控制 Chrome 浏览器,支持完整的自动化操作。
129
+ description: 'Chrome DevTools Protocol CLI Tool',
130
+ instructions: `Control Chrome browser through Chrome DevTools Protocol, supporting complete automation operations.
131
131
 
132
- ## 完整命令列表
132
+ ## Complete Command List
133
133
 
134
- ### 1. JavaScript 执行
135
- - **eval** - 执行 JavaScript 代码并返回结果,支持异步代码和 Promise
134
+ ### 1. JavaScript Execution
135
+ - **eval** - Execute JavaScript code and return results, supports async code and Promises
136
136
  \`chrome-cdp-cli eval "document.title"\`
137
137
  \`chrome-cdp-cli eval "fetch('/api/data').then(r => r.json())"\`
138
138
 
139
- ### 2. 页面截图和快照
140
- - **screenshot** - 捕获页面截图并保存到文件
139
+ ### 2. Page Screenshots and Snapshots
140
+ - **screenshot** - Capture page screenshot and save to file
141
141
  \`chrome-cdp-cli screenshot --filename page.png\`
142
142
  \`chrome-cdp-cli screenshot --filename fullpage.png --full-page\`
143
143
 
144
- - **snapshot** - 捕获完整 DOM 快照(包含结构、样式、布局)
144
+ - **snapshot** - Capture complete DOM snapshot (including structure, styles, layout)
145
145
  \`chrome-cdp-cli snapshot --filename dom-snapshot.json\`
146
146
 
147
- ### 3. 元素交互
148
- - **click** - 点击页面元素
147
+ ### 3. Element Interaction
148
+ - **click** - Click page elements
149
149
  \`chrome-cdp-cli click "#submit-button"\`
150
150
  \`chrome-cdp-cli click ".menu-item" --timeout 10000\`
151
151
 
152
- - **hover** - 鼠标悬停在元素上
152
+ - **hover** - Mouse hover over elements
153
153
  \`chrome-cdp-cli hover "#dropdown-trigger"\`
154
154
 
155
- - **fill** - 填充表单字段
155
+ - **fill** - Fill form fields
156
156
  \`chrome-cdp-cli fill "#username" "john@example.com"\`
157
157
  \`chrome-cdp-cli fill "input[name='password']" "secret123"\`
158
158
 
159
- - **fill_form** - 批量填充表单
159
+ - **fill_form** - Batch fill forms
160
160
  \`chrome-cdp-cli fill_form '{"#username": "john", "#password": "secret"}'\`
161
161
 
162
- ### 4. 高级交互
163
- - **drag** - 拖拽操作
162
+ ### 4. Advanced Interactions
163
+ - **drag** - Drag and drop operations
164
164
  \`chrome-cdp-cli drag "#draggable" "#dropzone"\`
165
165
 
166
- - **press_key** - 模拟键盘输入
166
+ - **press_key** - Simulate keyboard input
167
167
  \`chrome-cdp-cli press_key "Enter"\`
168
168
  \`chrome-cdp-cli press_key "a" --modifiers Ctrl --selector "#input"\`
169
169
 
170
- - **upload_file** - 文件上传
170
+ - **upload_file** - File upload
171
171
  \`chrome-cdp-cli upload_file "input[type='file']" "./document.pdf"\`
172
172
 
173
- - **wait_for** - 等待元素出现或满足条件
173
+ - **wait_for** - Wait for elements to appear or meet conditions
174
174
  \`chrome-cdp-cli wait_for "#loading" --condition hidden\`
175
175
  \`chrome-cdp-cli wait_for "#submit-btn" --condition enabled\`
176
176
 
177
- - **handle_dialog** - 处理浏览器对话框
177
+ - **handle_dialog** - Handle browser dialogs
178
178
  \`chrome-cdp-cli handle_dialog accept\`
179
179
  \`chrome-cdp-cli handle_dialog accept --text "user input"\`
180
180
 
181
- ### 5. 监控功能
182
- - **get_console_message** - 获取最新控制台消息
181
+ ### 5. Monitoring Features
182
+ - **get_console_message** - Get latest console message
183
183
  \`chrome-cdp-cli get_console_message\`
184
184
 
185
- - **list_console_messages** - 列出所有控制台消息
185
+ - **list_console_messages** - List all console messages
186
186
  \`chrome-cdp-cli list_console_messages --type error\`
187
187
 
188
- - **get_network_request** - 获取最新网络请求
188
+ - **get_network_request** - Get latest network request
189
189
  \`chrome-cdp-cli get_network_request\`
190
190
 
191
- - **list_network_requests** - 列出所有网络请求
191
+ - **list_network_requests** - List all network requests
192
192
  \`chrome-cdp-cli list_network_requests --method POST\`
193
193
 
194
- ### 6. IDE 集成
195
- - **install_cursor_command** - 安装 Cursor 命令
194
+ ### 6. IDE Integration
195
+ - **install_cursor_command** - Install Cursor commands
196
196
  \`chrome-cdp-cli install_cursor_command\`
197
197
 
198
- - **install_claude_skill** - 安装 Claude 技能
198
+ - **install_claude_skill** - Install Claude skills
199
199
  \`chrome-cdp-cli install_claude_skill --skill-type personal\`
200
200
 
201
- ## 常用工作流程
201
+ ## Common Workflows
202
202
 
203
- ### 完整的表单测试流程
203
+ ### Complete Form Testing Workflow
204
204
  \`\`\`bash
205
- # 1. 等待页面加载
205
+ # 1. Wait for page to load
206
206
  chrome-cdp-cli wait_for "#login-form" --condition visible
207
207
 
208
- # 2. 填写表单
208
+ # 2. Fill form
209
209
  chrome-cdp-cli fill "#email" "test@example.com"
210
210
  chrome-cdp-cli fill "#password" "password123"
211
211
 
212
- # 3. 提交表单
212
+ # 3. Submit form
213
213
  chrome-cdp-cli click "#submit-button"
214
214
 
215
- # 4. 等待结果并截图
215
+ # 4. Wait for result and take screenshot
216
216
  chrome-cdp-cli wait_for "#success-message" --condition visible
217
217
  chrome-cdp-cli screenshot --filename login-success.png
218
218
 
219
- # 5. 检查控制台错误
219
+ # 5. Check console errors
220
220
  chrome-cdp-cli list_console_messages --type error
221
221
  \`\`\`
222
222
 
223
- ### 文件上传测试
223
+ ### File Upload Testing
224
224
  \`\`\`bash
225
- # 1. 点击上传按钮
225
+ # 1. Click upload button
226
226
  chrome-cdp-cli click "#upload-trigger"
227
227
 
228
- # 2. 上传文件
228
+ # 2. Upload file
229
229
  chrome-cdp-cli upload_file "input[type='file']" "./test-document.pdf"
230
230
 
231
- # 3. 等待上传完成
231
+ # 3. Wait for upload completion
232
232
  chrome-cdp-cli wait_for ".upload-success" --condition visible
233
233
 
234
- # 4. 验证结果
234
+ # 4. Verify result
235
235
  chrome-cdp-cli eval "document.querySelector('.file-name').textContent"
236
236
  \`\`\`
237
237
 
238
- ### 拖拽交互测试
238
+ ### Drag and Drop Interaction Testing
239
239
  \`\`\`bash
240
- # 1. 等待元素可用
240
+ # 1. Wait for elements to be available
241
241
  chrome-cdp-cli wait_for "#draggable-item" --condition visible
242
242
  chrome-cdp-cli wait_for "#drop-zone" --condition visible
243
243
 
244
- # 2. 执行拖拽
244
+ # 2. Perform drag and drop
245
245
  chrome-cdp-cli drag "#draggable-item" "#drop-zone"
246
246
 
247
- # 3. 验证拖拽结果
247
+ # 3. Verify drag result
248
248
  chrome-cdp-cli eval "document.querySelector('#drop-zone').children.length"
249
249
  \`\`\`
250
250
 
251
- ### 键盘导航测试
251
+ ### Keyboard Navigation Testing
252
252
  \`\`\`bash
253
- # 1. 聚焦到输入框
253
+ # 1. Focus on input field
254
254
  chrome-cdp-cli click "#search-input"
255
255
 
256
- # 2. 输入文本
256
+ # 2. Type text
257
257
  chrome-cdp-cli press_key "t"
258
258
  chrome-cdp-cli press_key "e"
259
259
  chrome-cdp-cli press_key "s"
260
260
  chrome-cdp-cli press_key "t"
261
261
 
262
- # 3. 使用快捷键
263
- chrome-cdp-cli press_key "a" --modifiers Ctrl # 全选
264
- chrome-cdp-cli press_key "Enter" # 提交
262
+ # 3. Use keyboard shortcuts
263
+ chrome-cdp-cli press_key "a" --modifiers Ctrl # Select all
264
+ chrome-cdp-cli press_key "Enter" # Submit
265
265
 
266
- # 4. 处理可能的确认对话框
266
+ # 4. Handle possible confirmation dialog
267
267
  chrome-cdp-cli handle_dialog accept
268
268
  \`\`\`
269
269
 
270
- 命令会自动连接到运行在 localhost:9222 Chrome 实例。`,
270
+ Commands automatically connect to Chrome instance running on localhost:9222.`,
271
271
  examples: [
272
272
  'chrome-cdp-cli eval "document.title"',
273
273
  'chrome-cdp-cli screenshot --filename page.png',
@@ -290,74 +290,74 @@ chrome-cdp-cli handle_dialog accept
290
290
 
291
291
  ${command.instructions}
292
292
 
293
- ## 使用示例
293
+ ## Usage Examples
294
294
 
295
295
  ${examples}
296
296
 
297
- ## 前置条件
297
+ ## Prerequisites
298
298
 
299
- 确保 Chrome 浏览器已启动并开启了远程调试:
299
+ Ensure Chrome browser is started with remote debugging enabled:
300
300
 
301
301
  \`\`\`bash
302
302
  chrome --remote-debugging-port=9222
303
303
  \`\`\`
304
304
 
305
- 或者在 macOS 上:
305
+ Or on macOS:
306
306
 
307
307
  \`\`\`bash
308
308
  /Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222
309
309
  \`\`\`
310
310
 
311
- ## 全局选项
311
+ ## Global Options
312
312
 
313
- 所有命令都支持以下全局选项:
313
+ All commands support the following global options:
314
314
 
315
- - \`--host <hostname>\`: Chrome DevTools 主机地址 (默认: localhost)
316
- - \`--port <number>\`: Chrome DevTools 端口 (默认: 9222)
317
- - \`--format <json|text>\`: 输出格式 (默认: json)
318
- - \`--verbose\`: 启用详细日志
319
- - \`--quiet\`: 静默模式
320
- - \`--timeout <ms>\`: 命令超时时间
315
+ - \`--host <hostname>\`: Chrome DevTools host address (default: localhost)
316
+ - \`--port <number>\`: Chrome DevTools port (default: 9222)
317
+ - \`--format <json|text>\`: Output format (default: json)
318
+ - \`--verbose\`: Enable verbose logging
319
+ - \`--quiet\`: Silent mode
320
+ - \`--timeout <ms>\`: Command timeout
321
321
 
322
- ## 常用工作流程
322
+ ## Common Workflows
323
323
 
324
- ### 网页自动化测试
324
+ ### Web Automation Testing
325
325
  \`\`\`bash
326
- # 1. 导航到页面并截图
326
+ # 1. Navigate to page and take screenshot
327
327
  chrome-cdp-cli eval "window.location.href = 'https://example.com'"
328
328
  chrome-cdp-cli screenshot --filename before.png
329
329
 
330
- # 2. 填写表单
330
+ # 2. Fill form
331
331
  chrome-cdp-cli eval "document.querySelector('#email').value = 'test@example.com'"
332
332
  chrome-cdp-cli eval "document.querySelector('#password').value = 'password123'"
333
333
 
334
- # 3. 提交并检查结果
334
+ # 3. Submit and check results
335
335
  chrome-cdp-cli eval "document.querySelector('#submit').click()"
336
336
  chrome-cdp-cli screenshot --filename after.png
337
337
  chrome-cdp-cli list_console_messages --type error
338
338
  \`\`\`
339
339
 
340
- ### API 调用监控
340
+ ### API Call Monitoring
341
341
  \`\`\`bash
342
- # 1. 开始监控网络请求
342
+ # 1. Start monitoring network requests
343
343
  chrome-cdp-cli eval "fetch('/api/users').then(r => r.json())"
344
344
 
345
- # 2. 查看网络请求
345
+ # 2. View network requests
346
346
  chrome-cdp-cli list_network_requests --method POST
347
347
 
348
- # 3. 获取最新请求详情
348
+ # 3. Get latest request details
349
349
  chrome-cdp-cli get_network_request
350
350
  \`\`\`
351
351
 
352
- ### 页面分析
352
+ ### Page Analysis
353
353
  \`\`\`bash
354
- # 1. 获取页面基本信息
354
+ # 1. Get basic page information
355
355
  chrome-cdp-cli eval "({title: document.title, url: location.href, links: document.querySelectorAll('a').length})"
356
356
 
357
- # 2. 捕获完整页面结构
357
+ # 2. Capture complete page structure
358
358
  chrome-cdp-cli snapshot --filename page-analysis.json
359
359
 
360
- # 3. 检查控制台错误
360
+ # 3. Check console errors
361
361
  chrome-cdp-cli list_console_messages --type error
362
362
  \`\`\`
363
363
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-cdp-cli",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "LLM-first browser automation CLI via Chrome DevTools Protocol. Eval-first design optimized for AI assistants - LLMs write JavaScript scripts for rapid validation. Features: JavaScript execution, element interaction, screenshots, DOM snapshots, console/network monitoring. Built-in IDE integration for Cursor and Claude.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",