fix: move log dir from /tmp/playwriter to ~/.playwriter (fixes #44)

This commit is contained in:
Tommy D. Rossi
2026-02-06 10:44:28 +01:00
parent 7f3fddb2af
commit d6adb460d5
7 changed files with 24 additions and 13 deletions
+8 -4
View File
@@ -70,6 +70,10 @@ playwriter -s 1 -e "await page.screenshot({ path: 'screenshot.png', scale: 'css'
# Get accessibility snapshot
playwriter -s 1 -e "await accessibilitySnapshot({ page })"
# Get accessibility snapshot for a specific iframe
const frame = await page.locator('iframe').contentFrame()
await accessibilitySnapshot({ frame })
```
**Multiline code:**
@@ -92,11 +96,11 @@ EOF
### Debugging playwriter issues
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:
If some internal critical error happens you can read the relay server logs to understand the issue. The log file is located in the user home directory:
```bash
playwriter logfile # prints the log file path
# typically: /tmp/playwriter/relay-server.log (Linux/macOS) or %TEMP%\playwriter\relay-server.log (Windows)
# typically: ~/.playwriter/relay-server.log
```
The relay log contains logs from the extension, MCP and WS server. A separate CDP JSONL log is created alongside it (see `playwriter logfile`) with all CDP commands/responses and events, with long strings truncated. Both files are recreated every time the server starts. For debugging internal playwriter errors, read these files with grep/rg to find relevant lines.
@@ -104,7 +108,7 @@ The relay log contains logs from the extension, MCP and WS server. A separate CD
Example: summarize CDP traffic counts by direction + method:
```bash
jq -r '.direction + "\t" + (.message.method // "response")' /tmp/playwriter/cdp.jsonl | uniq -c
jq -r '.direction + "\t" + (.message.method // "response")' ~/.playwriter/cdp.jsonl | uniq -c
```
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.
@@ -113,7 +117,7 @@ If you find a bug, you can create a gh issue using `gh issue create -R remorses/
# 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.
Control user's Chrome browser via playwright code snippets. Prefer single-line code with semicolons between statements. Use playwriter immediately without waiting for user actions; only if you get "extension is not connected" or "no browser tabs have Playwriter enabled" should you ask the user to click the playwriter extension icon on the target tab.
You can collaborate with the user - they can help with captchas, difficult elements, or reproducing bugs.