标签
🌐 Tabs
| 命令 | 描述 |
|---|---|
tab-list | 列出所有打开的标签页 |
tab-new [url] | 打开一个新标签页 |
tab-select <index> | 按索引切换到标签页 |
tab-close [index] | 关闭一个标签页 |
列出标签
🌐 Listing tabs
$ playwright-cli tab-list
### Open tabs
- 0: (current) [React - TodoMVC](https://demo.playwright.dev/todomvc/)
- 1: [Example Domain](https://example.com/)
- 2: [Google](https://google.com/)
每当打开多个标签页,或者标签页集合发生变化时,Open tabs 部分也会自动包含在任何命令的输出中。
🌐 The Open tabs section is also included automatically in any command's output whenever more than
one tab is open, or whenever the set of tabs changes.
创建标签页
🌐 Creating tabs
playwright-cli tab-new # blank tab
playwright-cli tab-new https://example.com # navigate immediately
切换标签
🌐 Switching tabs
playwright-cli tab-select 1 # switch to second tab
playwright-cli tab-select 0 # switch back to first
关闭标签页
🌐 Closing tabs
playwright-cli tab-close # close current tab
playwright-cli tab-close 2 # close specific tab
工作流程:比较页面
🌐 Workflow: comparing pages
playwright-cli open https://staging.example.com
playwright-cli snapshot --filename=staging.yaml
playwright-cli tab-new https://example.com
playwright-cli snapshot --filename=production.yaml
# Agent compares the two snapshots