playwright-repl 0.16.0 → 0.17.0

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.
Files changed (2) hide show
  1. package/README.md +26 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -87,10 +87,9 @@ echo -e "goto https://example.com\nsnapshot" | playwright-repl
87
87
  | Mode | Standalone | Bridge |
88
88
  |------|:---:|:---:|
89
89
  | **Keyword** — `click "Sign in"`, `goto https://...` | ✅ | ✅ |
90
- | **JavaScript** — `document.title`, `window.location.href` | ❌ | ✅ auto-detected |
91
- | **Playwright API** — `await page.locator('button').count()` | ❌ | ✅ auto-detected |
90
+ | **Playwright API / JS** — `await page.title()`, `1 + 1` | ❌ | ✅ auto-detected |
92
91
 
93
- Bridge mode auto-detects JavaScript and Playwright API expressions — just type them directly. For the full keyword command list, see [Command Reference](#command-reference).
92
+ Bridge mode auto-detects Playwright API and JavaScript expressions — just type them directly. For DOM access use `await page.evaluate(() => document.title)`. For the full keyword command list, see [Command Reference](#command-reference).
94
93
 
95
94
  ## CLI Options
96
95
 
@@ -235,12 +234,36 @@ Short aliases are CLI-only.
235
234
  | `upload <ref> <file>` | — | Upload a file |
236
235
  | `drag <from> <to>` | — | Drag and drop |
237
236
 
237
+ ### Locator Flags
238
+
239
+ All text-based interaction commands support `--nth` and `--exact`:
240
+
241
+ | Flag | Description |
242
+ |------|-------------|
243
+ | `--nth <n>` | Select the nth visible match (0-indexed) |
244
+ | `--exact` | Exact text match only — skip the fallback chain |
245
+
246
+ ```
247
+ pw> click "Submit" --nth 0 # click the first "Submit"
248
+ pw> click "Submit" --exact # only exact text match, no fuzzy fallback
249
+ pw> fill "Email" "test" --exact # fill only if label is exactly "Email"
250
+ pw> highlight "npm" # show all matches (returns count)
251
+ → Highlighted 24 elements
252
+ pw> highlight "npm" --exact # only exact "npm", not "pnpm"
253
+ → Highlighted 2 elements
254
+ pw> highlight "npm" --nth 0 # highlight just the first match
255
+ → Highlighted 1 of 24
256
+ pw> highlight --clear # dismiss the highlight overlay
257
+ → Cleared
258
+ ```
259
+
238
260
  ### Inspection
239
261
 
240
262
  | Command | Alias | Description |
241
263
  |---------|-------|-------------|
242
264
  | `snapshot` | `s` | Accessibility tree with element refs |
243
265
  | `screenshot` | `ss` | Take a screenshot (saved to file) |
266
+ | `highlight <text\|selector>` | `hl` | Highlight matching elements on page |
244
267
  | `eval <expr>` | `e` | Evaluate JavaScript in browser context |
245
268
  | `console` | `con` | Browser console messages |
246
269
  | `network` | `net` | Network requests log |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-repl",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Interactive REPL for Playwright browser automation — keyword-driven testing from your terminal",
5
5
  "type": "module",
6
6
  "bin": {