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/dist/index.d.cts CHANGED
@@ -206,7 +206,7 @@ interface FormField {
206
206
  /** Ref ID of the form field (e.g. `'e3'`) */
207
207
  ref: string;
208
208
  /** Field type: `'text'`, `'checkbox'`, `'radio'`, etc. */
209
- type: string;
209
+ type?: string;
210
210
  /** Value to set. Booleans for checkboxes, strings for text fields. */
211
211
  value?: string | number | boolean;
212
212
  }
package/dist/index.d.ts CHANGED
@@ -206,7 +206,7 @@ interface FormField {
206
206
  /** Ref ID of the form field (e.g. `'e3'`) */
207
207
  ref: string;
208
208
  /** Field type: `'text'`, `'checkbox'`, `'radio'`, etc. */
209
- type: string;
209
+ type?: string;
210
210
  /** Value to set. Booleans for checkboxes, strings for text fields. */
211
211
  value?: string | number | boolean;
212
212
  }
package/dist/index.js CHANGED
@@ -1488,11 +1488,10 @@ async function fillFormViaPlaywright(opts) {
1488
1488
  for (let i = 0; i < opts.fields.length; i++) {
1489
1489
  const field = opts.fields[i];
1490
1490
  const ref = field.ref.trim();
1491
- const type = field.type.trim();
1491
+ const type = (typeof field.type === "string" ? field.type.trim() : "") || "text";
1492
1492
  const rawValue = field.value;
1493
1493
  const value = rawValue == null ? "" : String(rawValue);
1494
1494
  if (!ref) throw new Error(`fill(): field at index ${i} has empty ref`);
1495
- if (!type) throw new Error(`fill(): field "${ref}" has empty type`);
1496
1495
  const locator = refLocator(page, ref);
1497
1496
  if (type === "checkbox" || type === "radio") {
1498
1497
  const checked = rawValue === true || rawValue === 1 || rawValue === "1" || rawValue === "true";