Skip to main content

Tabs

CommandDescription
tab-listList all open tabs
tab-new [url]Open a new tab
tab-select <index>Switch to tab by index
tab-close [index]Close a tab

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/)

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