pw-repl 0.11.1 → 0.11.2
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/README.md +1 -1
- package/lib/help.js +3 -3
- package/lib/tabs.js +2 -2
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ the Docker bridge gateway, `ip route | awk '/default/ {print $3}'`).
|
|
|
88
88
|
|
|
89
89
|
| I want to… | Commands |
|
|
90
90
|
| ------------------------------------ | ------------------------------------------------------------------------------------- |
|
|
91
|
-
| see where I am | `tab` (it marks the tab you are looking at `(
|
|
91
|
+
| see where I am | `tab` (it marks the tab you are looking at `(visible)`), `info` |
|
|
92
92
|
| see what is on the page | `snapshot`, `screenshot` |
|
|
93
93
|
| do something on it | `click`, `fill`, `press` |
|
|
94
94
|
| wait for a page or element | `wait load`, `wait <selector>`, `wait <selector> --gone` |
|
package/lib/help.js
CHANGED
|
@@ -152,7 +152,7 @@ const COMMANDS = {
|
|
|
152
152
|
usage: 'tab [<index>|<url-part>|new [url]|close [url-part]]',
|
|
153
153
|
summary: 'list tabs (* is selected); select, open or close one',
|
|
154
154
|
args: [
|
|
155
|
-
['(none)', 'lists the tabs: * marks the selected one, (
|
|
155
|
+
['(none)', 'lists the tabs: * marks the selected one, (visible) the one the browser shows, and each says who opened it with tab new.'],
|
|
156
156
|
['<index>', 'selects by the number in your latest listing (each client has its own); numbers change when tabs open or close.'],
|
|
157
157
|
['<url-part>', 'selects the one tab whose URL contains it; refused if none or several do.'],
|
|
158
158
|
['new [url]', 'opens a tab behind the one in front, so it does not take the window from whoever is using it, and selects it. The URL is read as goto reads it.'],
|
|
@@ -161,11 +161,11 @@ const COMMANDS = {
|
|
|
161
161
|
detail: `Closing the selected tab goes back to the previous tab if tab new opened it; otherwise no tab is
|
|
162
162
|
selected, and commands that need one refuse until one is.
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
Visible: (visible) marks the tab the browser shows in its window, the one the user sees; (visible,
|
|
165
165
|
focused) when its window has the keyboard too, and it is not in the address bar. A tab a client has
|
|
166
166
|
selected or opened is never marked: pw-repl tells it that it is in front, so that it keeps drawing and
|
|
167
167
|
clicks in it work while it is behind another, and so cannot ask it. The user's other tabs are told
|
|
168
|
-
nothing, and say truly whether they are seen. Each window
|
|
168
|
+
nothing, and say truly whether they are seen. Each window shows a tab, so with several windows
|
|
169
169
|
(an incognito one, say) several tabs are marked; focused is the one with the keyboard.`,
|
|
170
170
|
},
|
|
171
171
|
goto: {
|
package/lib/tabs.js
CHANGED
|
@@ -105,7 +105,7 @@ async function pageForTarget(ctx, targetId) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// Every tab, URL first, with * on the selected one. The numbers are what tab <index> uses.
|
|
108
|
-
// Whether a tab is the one in front in its window, as the tab itself says: '
|
|
108
|
+
// Whether a tab is the one in front in its window, as the tab itself says: 'visible', 'visible,
|
|
109
109
|
// focused' (its window has the keyboard, and not in the address bar), or null. Not for a tab a client
|
|
110
110
|
// uses, which is told it is in front so that it draws (lib/cdp.js); nor for one that does not answer
|
|
111
111
|
// at once (a dialog open, a frozen tab). Each window has one in front, an incognito one too.
|
|
@@ -114,7 +114,7 @@ async function inFront(p) {
|
|
|
114
114
|
const read = p.evaluate(() => [document.visibilityState, document.hasFocus()]).catch(() => null);
|
|
115
115
|
const seen = await Promise.race([read, new Promise(resolve => setTimeout(resolve, FRONT_READ_TIMEOUT, null))]);
|
|
116
116
|
if (!seen || seen[0] !== 'visible') return null;
|
|
117
|
-
return seen[1] ? '
|
|
117
|
+
return seen[1] ? 'visible, focused' : 'visible';
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
async function listTabs() {
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -217,7 +217,7 @@ pw-repl send -c <name> close # your modes off; tab close
|
|
|
217
217
|
|
|
218
218
|
- The browser may have tabs that are not yours, and someone may be using it. Whether to read or act in
|
|
219
219
|
one of those tabs, or to open your own (`tab new <url>`), depends on the task; when that is not clear,
|
|
220
|
-
ask. `tab` marks `(
|
|
220
|
+
ask. `tab` marks `(visible)` the tab the user sees: "this page" is usually that one. A tab you have
|
|
221
221
|
selected is never marked (help tab says why).
|
|
222
222
|
- No tab is selected when the REPL starts. A start URL's tab, marked `(the start URL)` in `tab`, is
|
|
223
223
|
selected at its prompt and for `send` without a client name; a named client (`-c`) selects it with
|