browser-pilot 0.0.3 → 0.0.5

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/actions.cjs CHANGED
@@ -110,7 +110,8 @@ var BatchExecutor = class {
110
110
  await this.page.fill(step.selector, step.value, {
111
111
  timeout,
112
112
  optional,
113
- clear: step.clear ?? true
113
+ clear: step.clear ?? true,
114
+ blur: step.blur
114
115
  });
115
116
  return { selectorUsed: this.getUsedSelector(step.selector) };
116
117
  }
@@ -1,5 +1,5 @@
1
- import { P as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-C6m0bT04.cjs';
2
- export { A as ActionType, c as StepResult } from './types-C6m0bT04.cjs';
1
+ import { P as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-DQhA8uQZ.cjs';
2
+ export { A as ActionType, c as StepResult } from './types-DQhA8uQZ.cjs';
3
3
  import './client-7Nqka5MV.cjs';
4
4
 
5
5
  /**
package/dist/actions.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-BJv2dzu0.js';
2
- export { A as ActionType, c as StepResult } from './types-BJv2dzu0.js';
1
+ import { P as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-DKz34hii.js';
2
+ export { A as ActionType, c as StepResult } from './types-DKz34hii.js';
3
3
  import './client-7Nqka5MV.js';
4
4
 
5
5
  /**
package/dist/actions.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BatchExecutor,
3
3
  addBatchToPage
4
- } from "./chunk-YEHK2XY3.mjs";
4
+ } from "./chunk-6RB3GKQP.mjs";
5
5
  export {
6
6
  BatchExecutor,
7
7
  addBatchToPage
package/dist/browser.cjs CHANGED
@@ -542,7 +542,8 @@ var BatchExecutor = class {
542
542
  await this.page.fill(step.selector, step.value, {
543
543
  timeout,
544
544
  optional,
545
- clear: step.clear ?? true
545
+ clear: step.clear ?? true,
546
+ blur: step.blur
546
547
  });
547
548
  return { selectorUsed: this.getUsedSelector(step.selector) };
548
549
  }
@@ -1283,7 +1284,7 @@ var Page = class {
1283
1284
  * Fill an input field (clears first by default)
1284
1285
  */
1285
1286
  async fill(selector, value, options = {}) {
1286
- const { clear = true } = options;
1287
+ const { clear = true, blur = false } = options;
1287
1288
  return this.withStaleNodeRetry(async () => {
1288
1289
  const element = await this.findElement(selector, options);
1289
1290
  if (!element) {
@@ -1297,7 +1298,11 @@ var Page = class {
1297
1298
  const el = document.querySelector(${JSON.stringify(element.selector)});
1298
1299
  if (el) {
1299
1300
  el.value = '';
1300
- el.dispatchEvent(new Event('input', { bubbles: true }));
1301
+ el.dispatchEvent(new InputEvent('input', {
1302
+ bubbles: true,
1303
+ cancelable: true,
1304
+ inputType: 'deleteContent'
1305
+ }));
1301
1306
  }
1302
1307
  })()`
1303
1308
  );
@@ -1307,11 +1312,21 @@ var Page = class {
1307
1312
  `(() => {
1308
1313
  const el = document.querySelector(${JSON.stringify(element.selector)});
1309
1314
  if (el) {
1310
- el.dispatchEvent(new Event('input', { bubbles: true }));
1315
+ el.dispatchEvent(new InputEvent('input', {
1316
+ bubbles: true,
1317
+ cancelable: true,
1318
+ inputType: 'insertText',
1319
+ data: ${JSON.stringify(value)}
1320
+ }));
1311
1321
  el.dispatchEvent(new Event('change', { bubbles: true }));
1312
1322
  }
1313
1323
  })()`
1314
1324
  );
1325
+ if (blur) {
1326
+ await this.evaluateInFrame(
1327
+ `document.querySelector(${JSON.stringify(element.selector)})?.blur()`
1328
+ );
1329
+ }
1315
1330
  return true;
1316
1331
  });
1317
1332
  }
@@ -1,7 +1,7 @@
1
1
  import { C as CDPClient } from './client-7Nqka5MV.cjs';
2
2
  import { C as ConnectOptions } from './types-D_uDqh0Z.cjs';
3
- import { P as Page } from './types-C6m0bT04.cjs';
4
- export { d as ActionOptions, e as ActionResult, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, h as CustomSelectConfig, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, F as FileInput, o as FillOptions, G as GeolocationOptions, I as InteractiveElement, N as NavigationError, p as NetworkIdleOptions, q as PageError, r as PageSnapshot, s as SnapshotNode, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions } from './types-C6m0bT04.cjs';
3
+ import { P as Page } from './types-DQhA8uQZ.cjs';
4
+ export { d as ActionOptions, e as ActionResult, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, h as CustomSelectConfig, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, F as FileInput, o as FillOptions, G as GeolocationOptions, I as InteractiveElement, N as NavigationError, p as NetworkIdleOptions, q as PageError, r as PageSnapshot, s as SnapshotNode, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions } from './types-DQhA8uQZ.cjs';
5
5
 
6
6
  /**
7
7
  * Browser class - manages CDP connection and pages
package/dist/browser.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { C as CDPClient } from './client-7Nqka5MV.js';
2
2
  import { C as ConnectOptions } from './types-D_uDqh0Z.js';
3
- import { P as Page } from './types-BJv2dzu0.js';
4
- export { d as ActionOptions, e as ActionResult, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, h as CustomSelectConfig, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, F as FileInput, o as FillOptions, G as GeolocationOptions, I as InteractiveElement, N as NavigationError, p as NetworkIdleOptions, q as PageError, r as PageSnapshot, s as SnapshotNode, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions } from './types-BJv2dzu0.js';
3
+ import { P as Page } from './types-DKz34hii.js';
4
+ export { d as ActionOptions, e as ActionResult, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, h as CustomSelectConfig, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, F as FileInput, o as FillOptions, G as GeolocationOptions, I as InteractiveElement, N as NavigationError, p as NetworkIdleOptions, q as PageError, r as PageSnapshot, s as SnapshotNode, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions } from './types-DKz34hii.js';
5
5
 
6
6
  /**
7
7
  * Browser class - manages CDP connection and pages
package/dist/browser.mjs CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  Page,
6
6
  TimeoutError,
7
7
  connect
8
- } from "./chunk-CWSTSVWO.mjs";
8
+ } from "./chunk-NP56KSAN.mjs";
9
9
  import "./chunk-BCOZUKWS.mjs";
10
10
  import "./chunk-R3PS4PCM.mjs";
11
- import "./chunk-YEHK2XY3.mjs";
11
+ import "./chunk-6RB3GKQP.mjs";
12
12
  export {
13
13
  Browser,
14
14
  ElementNotFoundError,
@@ -83,7 +83,8 @@ var BatchExecutor = class {
83
83
  await this.page.fill(step.selector, step.value, {
84
84
  timeout,
85
85
  optional,
86
- clear: step.clear ?? true
86
+ clear: step.clear ?? true,
87
+ blur: step.blur
87
88
  });
88
89
  return { selectorUsed: this.getUsedSelector(step.selector) };
89
90
  }
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-R3PS4PCM.mjs";
7
7
  import {
8
8
  BatchExecutor
9
- } from "./chunk-YEHK2XY3.mjs";
9
+ } from "./chunk-6RB3GKQP.mjs";
10
10
 
11
11
  // src/network/interceptor.ts
12
12
  var RequestInterceptor = class {
@@ -621,7 +621,7 @@ var Page = class {
621
621
  * Fill an input field (clears first by default)
622
622
  */
623
623
  async fill(selector, value, options = {}) {
624
- const { clear = true } = options;
624
+ const { clear = true, blur = false } = options;
625
625
  return this.withStaleNodeRetry(async () => {
626
626
  const element = await this.findElement(selector, options);
627
627
  if (!element) {
@@ -635,7 +635,11 @@ var Page = class {
635
635
  const el = document.querySelector(${JSON.stringify(element.selector)});
636
636
  if (el) {
637
637
  el.value = '';
638
- el.dispatchEvent(new Event('input', { bubbles: true }));
638
+ el.dispatchEvent(new InputEvent('input', {
639
+ bubbles: true,
640
+ cancelable: true,
641
+ inputType: 'deleteContent'
642
+ }));
639
643
  }
640
644
  })()`
641
645
  );
@@ -645,11 +649,21 @@ var Page = class {
645
649
  `(() => {
646
650
  const el = document.querySelector(${JSON.stringify(element.selector)});
647
651
  if (el) {
648
- el.dispatchEvent(new Event('input', { bubbles: true }));
652
+ el.dispatchEvent(new InputEvent('input', {
653
+ bubbles: true,
654
+ cancelable: true,
655
+ inputType: 'insertText',
656
+ data: ${JSON.stringify(value)}
657
+ }));
649
658
  el.dispatchEvent(new Event('change', { bubbles: true }));
650
659
  }
651
660
  })()`
652
661
  );
662
+ if (blur) {
663
+ await this.evaluateInFrame(
664
+ `document.querySelector(${JSON.stringify(element.selector)})?.blur()`
665
+ );
666
+ }
653
667
  return true;
654
668
  });
655
669
  }