pw-repl 0.12.7 → 0.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -1
- package/README.md +76 -74
- package/bin/pw-repl.js +56 -33
- package/lib/cli-names.js +3 -3
- package/lib/elements.js +115 -26
- package/lib/emulation.js +2 -1
- package/lib/help.js +114 -47
- package/lib/inspect.js +22 -5
- package/lib/launch.js +3 -1
- package/lib/record.js +1 -1
- package/lib/runner.js +11 -0
- package/lib/send.js +16 -4
- package/lib/start.js +7 -2
- package/lib/syntax.js +11 -5
- package/package.json +1 -1
- package/skill/SKILL.md +27 -40
package/skill/SKILL.md
CHANGED
|
@@ -43,7 +43,8 @@ and check the skill it names against the top of this file. It says whether a REP
|
|
|
43
43
|
`send` reaches it, or that one is still starting (retry shortly; it exits 64 until the REPL serves, as
|
|
44
44
|
when none is running). Right after you start one, for a moment before its process is up, it can still
|
|
45
45
|
say none is there: retry for a few seconds before taking that as a failed start. There are three ways to
|
|
46
|
-
run one; each takes an optional start URL, which opens in a new tab
|
|
46
|
+
run one; each takes an optional start URL, which opens in a new tab (with `--launch`, in its browser's
|
|
47
|
+
first tab).
|
|
47
48
|
|
|
48
49
|
- `pw-repl serve --background` runs it detached, with a command server on `/tmp/pw-repl.sock`
|
|
49
50
|
(owner-only) and its output in `/tmp/pw-repl.log`. `pw-repl attach` shows everything it does and
|
|
@@ -52,14 +53,14 @@ run one; each takes an optional start URL, which opens in a new tab.
|
|
|
52
53
|
- `pw-repl serve` runs the same in a terminal, where the pane shows every command. Its prompt is
|
|
53
54
|
`pw[serve]>`. It stops at that prompt (`quit`, or Ctrl-C); `pw-repl stop` is for a background one.
|
|
54
55
|
- Add `--launch` to `run` or `serve` (with or without `--background`) to have it start a Chromium of its
|
|
55
|
-
own instead of connecting to one: headless unless `--headed`, in a
|
|
56
|
-
of its own (never 9222). It stops with the REPL, Ctrl-C while it starts
|
|
57
|
-
once it has exited. It prints the command it ran; flags after `--` are
|
|
58
|
-
flags: a start URL goes before `--`), and a `--user-data-dir=<dir>`
|
|
59
|
-
temporary profile, and kept. Started again in a kept profile,
|
|
60
|
-
it would for the user, headless too: its tabs come back, and
|
|
61
|
-
stays. They start loading before the REPL is attached, so
|
|
62
|
-
came after, often nothing: `reload` for a full record.
|
|
56
|
+
own instead of connecting to one: headless unless `--headed`, in a 1280x800 window, in a temporary
|
|
57
|
+
profile, on a free port of its own (never 9222). It stops with the REPL, Ctrl-C while it starts
|
|
58
|
+
included, and `stop` returns once it has exited. It prints the command it ran; flags after `--` are
|
|
59
|
+
passed to that Chromium (only flags: a start URL goes before `--`), and a `--user-data-dir=<dir>`
|
|
60
|
+
among them is used instead of the temporary profile, and kept. Started again in a kept profile,
|
|
61
|
+
Chromium picks up where it left off, as it would for the user, headless too: its tabs come back, and
|
|
62
|
+
session cookies with them, so a login stays. They start loading before the REPL is attached, so
|
|
63
|
+
`requests` and `console` have only what came after, often nothing: `reload` for a full record.
|
|
63
64
|
- `pw-repl run` runs it in a terminal with no server; `send` then reaches it through tmux, if it runs in
|
|
64
65
|
the tmux session `pw-repl`:
|
|
65
66
|
|
|
@@ -136,9 +137,10 @@ line, not in it; the REPL puts it in only as it runs the line, and its pane and
|
|
|
136
137
|
written, so neither the file nor the line as logged holds the secret. Only `PW_` names are variables;
|
|
137
138
|
any other `{{ ... }}` (a page's template text) is sent as written. One that is not set stops the file;
|
|
138
139
|
`--no-vars` sends it as written. A single `send` takes them too: `PW_PASSWORD=... pw-repl send fill
|
|
139
|
-
'#password' "{{ PW_PASSWORD }}"` types a password without it in the command.
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
'#password' "{{ PW_PASSWORD }}"` types a password without it in the command. Give the value without
|
|
141
|
+
typing it, from a file only you can read: `PW_PASSWORD="$(cat <file>)" pw-repl send ...`. What reads it
|
|
142
|
+
back can still show it: `snapshot`, `html` and `attrs` hide a password field's value, `eval` on the
|
|
143
|
+
field does not.
|
|
142
144
|
|
|
143
145
|
`send` takes one command; chain several in your shell. Use `&&` when a step only makes sense if the one
|
|
144
146
|
before it worked: it stops at any exit status but 0, a failure and an outcome not confirmed included.
|
|
@@ -161,40 +163,24 @@ background REPL (server commands as `[server]` lines), so whoever looks there se
|
|
|
161
163
|
shows REPL commands only, not what was clicked in the browser (unless `watch on --live` is on); for
|
|
162
164
|
that, look at the browser itself: `tab` and `info` for where things are, `requests` for the requests the
|
|
163
165
|
clicks made (`body <#>` for what one returned), `console` for console messages and page errors.
|
|
164
|
-
`watch on` records each step someone takes in a tab, with the requests it caused
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
runs again, a repro to keep. What is typed is recorded, except in password fields; `watch on
|
|
169
|
-
--no-values` leaves it out. The file has a `{{ PW_PASSWORD }}` variable where a password was typed,
|
|
170
|
-
set when it runs (`PW_PASSWORD=... pw-repl send --file login.txt`), so the file can be shared without
|
|
171
|
-
it.
|
|
172
|
-
|
|
173
|
-
When watching someone:
|
|
174
|
-
|
|
175
|
-
- A watched tab keeps response bodies of up to 100 KB, so `body <#>` still has them after the tab
|
|
176
|
-
navigates. Read a bigger one that matters as soon as it shows up in `requests`: the browser drops it
|
|
177
|
-
once the tab navigates.
|
|
178
|
-
- `watch` leaves out images and other static files, failed ones too; `console error` and
|
|
179
|
-
`requests --all` show what failed.
|
|
180
|
-
- Without a url-part, `--next-tab` takes the first tab anyone opens; check `tab` and `info` once it
|
|
181
|
-
fires, since another tab opening later does not show in `watch`.
|
|
182
|
-
- A watch belongs to the tab: when another client watches it too, read it with `watch <n>`, since
|
|
183
|
-
`watch new`'s place is shared and each one's would hide steps from the other.
|
|
166
|
+
`watch on` records each step someone takes in a tab, with the requests it caused; `watch` reads it back,
|
|
167
|
+
and `watch save <file>` writes the steps as commands that `send --file` runs again, a repro to keep.
|
|
168
|
+
Before you watch someone, read `help watch`: what it keeps and leaves out, passwords, and sharing a watch
|
|
169
|
+
with another client.
|
|
184
170
|
|
|
185
171
|
When a page is slow or feels laggy, `requests` shows a slow response; for what the page itself is busy
|
|
186
|
-
with, `profile on` and `profile off` around what you do, or while the user uses it
|
|
187
|
-
trace of the tab: long tasks and the function behind each, forced layouts, each click's time to the next
|
|
188
|
-
paint, and frames dropped while scrolling or dragging. `profile reload` profiles a load. `help profile`.
|
|
172
|
+
with, `profile on` and `profile off` around what you do, or while the user uses it (`help profile`).
|
|
189
173
|
|
|
190
174
|
Exit status: `0` ok, `1` the command failed, `2` completion not confirmed (outcome unknown: do not
|
|
191
|
-
blindly retry a change), `64` usage or the REPL is not reachable. `pw-repl --help` has the options
|
|
175
|
+
blindly retry a change), `64` usage or the REPL is not reachable. `pw-repl --help` has the options, and
|
|
176
|
+
`pw-repl send --help` the rest of send's.
|
|
192
177
|
|
|
193
178
|
## Learn the commands
|
|
194
179
|
|
|
195
180
|
Run `pw-repl send help`. It lists seven topics; `help <topic>` lists their commands, `help <command>`
|
|
196
|
-
gives usage and caveats: read it before you use a command, since this file does not repeat them.
|
|
197
|
-
|
|
181
|
+
gives usage and caveats: read it before you use a command, since this file does not repeat them. When a
|
|
182
|
+
command fails or does something you did not expect, read its `help <command>` before working around it.
|
|
183
|
+
`help --all` prints everything at once. pw-repl answers help itself: it needs no running REPL, and never
|
|
198
184
|
reaches one. If you know playwright-cli, its command names work too (`help playwright-cli` lists them).
|
|
199
185
|
|
|
200
186
|
### Coming from playwright-cli
|
|
@@ -210,8 +196,9 @@ pw-repl send -c <name> click e5
|
|
|
210
196
|
pw-repl send -c <name> close # your modes off; tab close <url-part> closes yours
|
|
211
197
|
```
|
|
212
198
|
|
|
213
|
-
- There is no browser of your own to open or close: `open` opens a tab in the one the REPL uses,
|
|
214
|
-
|
|
199
|
+
- There is no browser of your own to open or close: `open` opens a new tab in the one the REPL uses,
|
|
200
|
+
each time, so use it once and `goto <url>` after that, which navigates the selected tab. `close` turns
|
|
201
|
+
off the modes you turned on and leaves every tab open.
|
|
215
202
|
- Instead of `-s=<session>`, send as a client: `-c <name>`, with a selected tab of its own, in a browser
|
|
216
203
|
whose cookies and storage are shared.
|
|
217
204
|
- `upload <selector> <file>` names the file input or the button that opens it; do not click a file
|