launch
VS Code Automation
Automate VS Code (Code OSS) using @playwright/cli. VS Code is built on Electron/Chromium and exposes a Chrome DevTools Protocol (CDP) port that @playwright/cli can attach to, enabling the same snapshot-interact workflow used for web pages.
Prerequisites
@playwright/cliis available via devDependencies. Runnpm installat the repo root, then usenpx @playwright/clito invoke commands. Alternatively, install globally withnpm install -g @playwright/cli.- For Code OSS (VS Code dev build): The repo must be built before launching.
./scripts/code.shruns the build automatically if needed, or setVSCODE_SKIP_PRELAUNCH=1to skip the compile step if you've already built. - CSS selectors are internal implementation details. Selectors like
.interactive-input-part,.interactive-input-editor, and.part.auxiliarybarused inevalcommands are VS Code internals that may change across versions. If they stop working, usenpx @playwright/cli snapshotto re-discover the current DOM structure.
Core Workflow
- Launch Code OSS with remote debugging enabled
- Attach npx @playwright/cli to the CDP port
- Snapshot to discover interactive elements
- Interact using element refs
- Re-snapshot after navigation or state changes
📸 Take screenshots for a paper trail. Use
npx @playwright/cli screenshot --filename=<path>at key moments — after launch, before/after interactions, and when something goes wrong. Screenshots provide visual proof of what the UI looked like and are invaluable for debugging failures or documenting what was accomplished.
More from microsoft/vscode
fix-errors
Guidelines for fixing unhandled errors from the VS Code error telemetry dashboard. Use when investigating error-telemetry issues with stack traces, error messages, and hit/user counts. Covers tracing data flow through call stacks, identifying producers of invalid data vs. consumers that crash, enriching error messages for telemetry diagnosis, and avoiding common anti-patterns like silently swallowing errors.
981azure-pipelines
Use when validating Azure DevOps pipeline changes for the VS Code build. Covers queueing builds, checking build status, viewing logs, and iterating on pipeline YAML changes without waiting for full CI runs.
959accessibility
Primary accessibility skill for VS Code. REQUIRED for new feature and contribution work, and also applies to updates of existing UI. Covers accessibility help dialogs, accessible views, verbosity settings, signals, ARIA announcements, keyboard navigation, and ARIA labels/roles.
958memory-leak-audit
Audit code for memory leaks and disposable issues. Use when reviewing event listeners, DOM handlers, lifecycle callbacks, or fixing leak reports. Covers addDisposableListener, Event.once, MutableDisposable, DisposableStore, and onWillDispose patterns.
909sessions
Agents window architecture — covers the agents-first app, layering, folder structure, chat widget, menus, contributions, entry points, and development guidelines. Use when implementing features or fixing issues in the Agents window.
903agent-sessions-layout
Agents workbench layout — covers the fixed layout structure, grid configuration, part visibility, editor modal, titlebar, sidebar footer, and implementation requirements. Use when implementing features or fixing issues in the Agents workbench layout.
901