Running browser operations by Claude Code & Playwright MCP in parallel using tmux and working it on each branch with git worktree
llmgitPlaywright MCP is Microsoft’s official MCP implementation of Playwright for cross-browser E2E testing of web applications.
$ claude mcp add playwright npx @playwright/mcp@latest
$ time claude -p "Access sambaiz.net and get 5 genres. \
Access each {genre} page, take a screenshot, and copy it to the screenshot/{genre}/ directory."
...
claude -p 2.64s user 0.96s system 2% cpu 2:53.38 total
$ tree screenshot
screenshot
├── aws
│ └── screenshot-aws-aws-page.png
├── golang
│ └── screenshot-golang-golang-page.png
├── kubernetes
│ └── screenshot-kubernetes-kubernetes-page.png
├── machinelearning
│ └── screenshot-machinelearning-machinelearning-page.png
└── python
└── screenshot-python-python-page.png
git worktree creates a directory that points to the target branch. This allows you to work on multiple branches simultaneously. You cannot create worktrees for the same branch.
$ git branch -c aaa
$ git worktree add worktree_aaa/ aaa
Preparing worktree (checking out 'aaa')
HEAD is now at d977ff9 initial │HEAD is now at d977ff9 initial
$ git branch
* main
+ aaa
$ cd worktree_aaa && git branch
+ main
* aaa
$ git worktree remove worktree_aaa
Let’s try splitting windows in tmux, creating worktrees, and running Claude Code in parallel. Since the previous context is not considered, simply instructing “Access each page” won’t work. To resolve issues like unpredictable behavior and lack of reproducibility, I ended up writing commands. It seems better to have it write a script and execute it for better control. Note that the –isolated flag is required to run Playwright in parallel.
$ claude mcp add -s user playwright npx -- @playwright/mcp@latest --isolated
$ claude "Access sambaiz.net and get 5 genres. \
Don't create a new script. \
Do tasks in parallel for each {genre}. \
To do it, run a following command. Don't edit the command.
tmux split-window -h \"git branch -c {genre} && \
git worktree add worktree_{genre} {genre} && \
cd worktree_{genre} && \
claude \"Access https://www.sambaiz.net/tags/{genre} page with playwright MCP, take a screenshot, and copy it to the screenshot/{genre}/ directory. Don't do other things.\""
$ tree
.
├── worktree_aws
│ └── screenshot
│ └── aws
│ └── aws-tags-page.png
├── worktree_golang
│ └── screenshot
│ └── golang
│ └── sambaiz-golang-page.png
├── worktree_kubernetes
│ └── screenshot
│ └── kubernetes
│ └── kubernetes-page.png
├── worktree_machinelearning
│ └── screenshot
│ └── machinelearning
│ └── machinelearning-page.png
└── worktree_python
└── screenshot
└── python
└── page-2025-07-14T02-05-42-589Z.jpeg