browserclaw 0.3.7 → 0.3.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <h2 align="center">🦞 BrowserClaw — Standalone OpenClaw browser module</h1>
1
+ <h2 align="center">🦞 BrowserClaw — Standalone OpenClaw browser module</h2>
2
2
 
3
3
  <p align="center">
4
4
  <a href="https://www.npmjs.com/package/browserclaw"><img src="https://img.shields.io/npm/v/browserclaw.svg" alt="npm version" /></a>
@@ -217,13 +217,13 @@ await page.press('Meta+Shift+p');
217
217
 
218
218
  // Fill multiple form fields at once
219
219
  await page.fill([
220
- { ref: 'e2', type: 'text', value: 'Jane Doe' },
221
- { ref: 'e4', type: 'text', value: 'jane@example.com' },
220
+ { ref: 'e2', value: 'Jane Doe' },
221
+ { ref: 'e4', value: 'jane@example.com' },
222
222
  { ref: 'e6', type: 'checkbox', value: true },
223
223
  ]);
224
224
  ```
225
225
 
226
- `fill()` field types: `'text'` calls Playwright `fill()` with the string value. `'checkbox'` and `'radio'` call `setChecked()` — truthy values are `true`, `1`, `'1'`, `'true'`. Empty ref or type throws.
226
+ `fill()` field types: `'text'` (default) calls Playwright `fill()` with the string value. `'checkbox'` and `'radio'` call `setChecked()` — truthy values are `true`, `1`, `'1'`, `'true'`. Type can be omitted and defaults to `'text'`. Empty ref throws.
227
227
 
228
228
  #### Highlight
229
229
 
package/dist/index.cjs CHANGED
@@ -1497,11 +1497,10 @@ async function fillFormViaPlaywright(opts) {
1497
1497
  for (let i = 0; i < opts.fields.length; i++) {
1498
1498
  const field = opts.fields[i];
1499
1499
  const ref = field.ref.trim();
1500
- const type = field.type.trim();
1500
+ const type = (typeof field.type === "string" ? field.type.trim() : "") || "text";
1501
1501
  const rawValue = field.value;
1502
1502
  const value = rawValue == null ? "" : String(rawValue);
1503
1503
  if (!ref) throw new Error(`fill(): field at index ${i} has empty ref`);
1504
- if (!type) throw new Error(`fill(): field "${ref}" has empty type`);
1505
1504
  const locator = refLocator(page, ref);
1506
1505
  if (type === "checkbox" || type === "radio") {
1507
1506
  const checked = rawValue === true || rawValue === 1 || rawValue === "1" || rawValue === "true";