Add playwriter logfile command and fix documentation paths

This commit is contained in:
Tommy D. Rossi
2026-01-24 18:31:33 +01:00
parent 0b2ef17040
commit 5469af0d30
6 changed files with 33 additions and 5 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ NEVER call browser.close() in tests or any other code that interacts with our CD
remember that every time the extension is activated in a tab that tab gets added to the available pages. so if you toggle the extension and then do .newPage() there will be 2 pages, not 1.
to debug server or extension issues you can also inspect the file @playwriter/relay-server.log to see both extension and server logs. with all cdp events sent. to see if there are events missing or something broken. this file is recreated every time the server is started and appended in real time. use rg to only read relevant lines and parts because it can get quite long
to debug server or extension issues you can inspect the relay server log file. run `playwriter logfile` to get the path (it's in the system temp directory, e.g. `/tmp/playwriter/relay-server.log` on Linux/macOS). this file contains logs from the extension, MCP and WS server together, with all CDP events. the file is recreated every time the server starts and appended in real time. use rg to only read relevant lines because it can get quite long
IMPORTANT: `pnpm test` will take about 1 minute or more so set a timeout of at least 90000ms when running the pnpm test bash command
+1 -1
View File
@@ -65,7 +65,7 @@ NEVER call browser.close() in tests or any other code that interacts with our CD
remember that every time the extension is activated in a tab that tab gets added to the available pages. so if you toggle the extension and then do .newPage() there will be 2 pages, not 1.
to debug server or extension issues you can also inspect the file @playwriter/relay-server.log to see both extension and server logs. with all cdp events sent. to see if there are events missing or something broken. this file is recreated every time the server is started and appended in real time. use rg to only read relevant lines and parts because it can get quite long
to debug server or extension issues you can inspect the relay server log file. run `playwriter logfile` to get the path (it's in the system temp directory, e.g. `/tmp/playwriter/relay-server.log` on Linux/macOS). this file contains logs from the extension, MCP and WS server together, with all CDP events. the file is recreated every time the server starts and appended in real time. use rg to only read relevant lines because it can get quite long
IMPORTANT: `pnpm test` will take about 1 minute or more so set a timeout of at least 90000ms when running the pnpm test bash command
+11
View File
@@ -232,6 +232,17 @@ npx -y playwriter serve --host 127.0.0.1
const browser = await chromium.connectOverCDP('http://127.0.0.1:19988')
```
## Troubleshooting
View relay server logs to debug issues:
```bash
playwriter logfile # prints the log file path
# typically: /tmp/playwriter/relay-server.log (Linux/macOS)
```
The log file contains extension, MCP and WebSocket server logs with all CDP events. It's recreated on each server start.
## Known Issues
- If all pages return `about:blank`, restart Chrome (Chrome bug in `chrome.debugger` API)
+6
View File
@@ -311,6 +311,12 @@ cli
})
})
cli
.command('logfile', 'Print the path to the relay server log file')
.action(() => {
console.log(LOG_FILE_PATH)
})
cli.help()
cli.version(VERSION)
+13 -2
View File
@@ -91,7 +91,9 @@ EOF
)"
```
# playwriter execute
---
# playwriter best practices
Control user's Chrome browser via playwright code snippets. Prefer single-line code with semicolons between statements. If you get "extension is not connected" or "no browser tabs have Playwriter enabled" error, tell user to click the playwriter extension icon on the tab they want to control.
@@ -516,4 +518,13 @@ Examples of what playwriter can do:
## debugging playwriter issues
if some internal critical error happens you can read your own relay ws logs to understand the issue, it will show logs from extension, mcp and ws server together. then you can create a gh issue using `gh issue create -R remorses/playwriter --title title --body body`. ask for user confirmation before doing this.
if some internal critical error happens you can read the relay server logs to understand the issue. the log file is located in the system temp directory:
```bash
playwriter logfile # prints the log file path
# typically: /tmp/playwriter/relay-server.log (Linux/macOS) or %TEMP%\playwriter\relay-server.log (Windows)
```
the log file contains logs from the extension, MCP and WS server together with all CDP events. the file is recreated every time the server starts. for debugging internal playwriter errors, read this file with grep/rg to find relevant lines.
if you find a bug, you can create a gh issue using `gh issue create -R remorses/playwriter --title title --body body`. ask for user confirmation before doing this.
+1 -1
View File
@@ -389,7 +389,7 @@ If `Target.attachedToTarget` is sent with empty URL:
### Debugging empty URL issues
Check the logs at `~/.config/opencode/playwriter.log` for:
Check the relay server logs (run `playwriter logfile` to get the path) for:
```
WARNING: Target.attachedToTarget sent with empty URL
WARNING: Target.attachedToTarget received with empty URL