browserclaw 0.12.3 → 0.12.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/README.md +3 -1
- package/dist/index.cjs +3418 -2872
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +136 -132
- package/dist/index.d.ts +136 -132
- package/dist/index.js +3418 -2872
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2,135 +2,6 @@ import { BrowserContext, Page, Locator, CDPSession } from 'playwright-core';
|
|
|
2
2
|
import { lookup } from 'node:dns';
|
|
3
3
|
import { lookup as lookup$1 } from 'node:dns/promises';
|
|
4
4
|
|
|
5
|
-
/** A single action within a batch. */
|
|
6
|
-
type BatchAction = {
|
|
7
|
-
kind: 'click';
|
|
8
|
-
ref?: string;
|
|
9
|
-
selector?: string;
|
|
10
|
-
targetId?: string;
|
|
11
|
-
doubleClick?: boolean;
|
|
12
|
-
button?: string;
|
|
13
|
-
modifiers?: string[];
|
|
14
|
-
delayMs?: number;
|
|
15
|
-
timeoutMs?: number;
|
|
16
|
-
} | {
|
|
17
|
-
kind: 'type';
|
|
18
|
-
ref?: string;
|
|
19
|
-
selector?: string;
|
|
20
|
-
text: string;
|
|
21
|
-
targetId?: string;
|
|
22
|
-
submit?: boolean;
|
|
23
|
-
slowly?: boolean;
|
|
24
|
-
timeoutMs?: number;
|
|
25
|
-
} | {
|
|
26
|
-
kind: 'press';
|
|
27
|
-
key: string;
|
|
28
|
-
targetId?: string;
|
|
29
|
-
delayMs?: number;
|
|
30
|
-
} | {
|
|
31
|
-
kind: 'hover';
|
|
32
|
-
ref?: string;
|
|
33
|
-
selector?: string;
|
|
34
|
-
targetId?: string;
|
|
35
|
-
timeoutMs?: number;
|
|
36
|
-
} | {
|
|
37
|
-
kind: 'scrollIntoView';
|
|
38
|
-
ref?: string;
|
|
39
|
-
selector?: string;
|
|
40
|
-
targetId?: string;
|
|
41
|
-
timeoutMs?: number;
|
|
42
|
-
} | {
|
|
43
|
-
kind: 'drag';
|
|
44
|
-
startRef?: string;
|
|
45
|
-
startSelector?: string;
|
|
46
|
-
endRef?: string;
|
|
47
|
-
endSelector?: string;
|
|
48
|
-
targetId?: string;
|
|
49
|
-
timeoutMs?: number;
|
|
50
|
-
} | {
|
|
51
|
-
kind: 'select';
|
|
52
|
-
ref?: string;
|
|
53
|
-
selector?: string;
|
|
54
|
-
values: string[];
|
|
55
|
-
targetId?: string;
|
|
56
|
-
timeoutMs?: number;
|
|
57
|
-
} | {
|
|
58
|
-
kind: 'fill';
|
|
59
|
-
fields: {
|
|
60
|
-
ref: string;
|
|
61
|
-
type?: string;
|
|
62
|
-
value?: string | number | boolean;
|
|
63
|
-
}[];
|
|
64
|
-
targetId?: string;
|
|
65
|
-
timeoutMs?: number;
|
|
66
|
-
} | {
|
|
67
|
-
kind: 'resize';
|
|
68
|
-
width: number;
|
|
69
|
-
height: number;
|
|
70
|
-
targetId?: string;
|
|
71
|
-
} | {
|
|
72
|
-
kind: 'wait';
|
|
73
|
-
timeMs?: number;
|
|
74
|
-
text?: string;
|
|
75
|
-
textGone?: string;
|
|
76
|
-
selector?: string;
|
|
77
|
-
url?: string;
|
|
78
|
-
loadState?: 'load' | 'domcontentloaded' | 'networkidle';
|
|
79
|
-
fn?: string;
|
|
80
|
-
arg?: unknown;
|
|
81
|
-
targetId?: string;
|
|
82
|
-
timeoutMs?: number;
|
|
83
|
-
} | {
|
|
84
|
-
kind: 'evaluate';
|
|
85
|
-
fn: string;
|
|
86
|
-
ref?: string;
|
|
87
|
-
targetId?: string;
|
|
88
|
-
timeoutMs?: number;
|
|
89
|
-
} | {
|
|
90
|
-
kind: 'close';
|
|
91
|
-
targetId?: string;
|
|
92
|
-
} | {
|
|
93
|
-
kind: 'batch';
|
|
94
|
-
actions: BatchAction[];
|
|
95
|
-
targetId?: string;
|
|
96
|
-
stopOnError?: boolean;
|
|
97
|
-
};
|
|
98
|
-
/** Result of a single action within a batch. */
|
|
99
|
-
type BatchActionResult = {
|
|
100
|
-
ok: true;
|
|
101
|
-
} | {
|
|
102
|
-
ok: false;
|
|
103
|
-
error: string;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Execute a single batch action.
|
|
107
|
-
*/
|
|
108
|
-
declare function executeSingleAction(action: BatchAction, cdpUrl: string, targetId: string | undefined, evaluateEnabled: boolean, depth?: number): Promise<void>;
|
|
109
|
-
/**
|
|
110
|
-
* Execute multiple browser actions in sequence.
|
|
111
|
-
*
|
|
112
|
-
* @param opts.actions - Array of actions to execute
|
|
113
|
-
* @param opts.stopOnError - Stop on first error (default: true)
|
|
114
|
-
* @param opts.evaluateEnabled - Whether evaluate/wait:fn actions are permitted
|
|
115
|
-
* @param opts.depth - Internal recursion depth (do not set manually)
|
|
116
|
-
*/
|
|
117
|
-
declare function batchViaPlaywright(opts: {
|
|
118
|
-
cdpUrl: string;
|
|
119
|
-
targetId?: string;
|
|
120
|
-
actions: BatchAction[];
|
|
121
|
-
stopOnError?: boolean;
|
|
122
|
-
evaluateEnabled?: boolean;
|
|
123
|
-
depth?: number;
|
|
124
|
-
}): Promise<{
|
|
125
|
-
results: BatchActionResult[];
|
|
126
|
-
}>;
|
|
127
|
-
|
|
128
|
-
interface FrameEvalResult {
|
|
129
|
-
frameUrl: string;
|
|
130
|
-
frameName: string;
|
|
131
|
-
result: unknown;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
5
|
/**
|
|
135
6
|
* Policy for controlling which URLs browser navigation is allowed to reach.
|
|
136
7
|
* Defaults to trusted-network mode (private/internal addresses allowed).
|
|
@@ -701,6 +572,136 @@ interface PinnedHostname {
|
|
|
701
572
|
lookup: typeof lookup;
|
|
702
573
|
}
|
|
703
574
|
|
|
575
|
+
/** A single action within a batch. */
|
|
576
|
+
type BatchAction = {
|
|
577
|
+
kind: 'click';
|
|
578
|
+
ref?: string;
|
|
579
|
+
selector?: string;
|
|
580
|
+
targetId?: string;
|
|
581
|
+
doubleClick?: boolean;
|
|
582
|
+
button?: string;
|
|
583
|
+
modifiers?: string[];
|
|
584
|
+
delayMs?: number;
|
|
585
|
+
timeoutMs?: number;
|
|
586
|
+
} | {
|
|
587
|
+
kind: 'type';
|
|
588
|
+
ref?: string;
|
|
589
|
+
selector?: string;
|
|
590
|
+
text: string;
|
|
591
|
+
targetId?: string;
|
|
592
|
+
submit?: boolean;
|
|
593
|
+
slowly?: boolean;
|
|
594
|
+
timeoutMs?: number;
|
|
595
|
+
} | {
|
|
596
|
+
kind: 'press';
|
|
597
|
+
key: string;
|
|
598
|
+
targetId?: string;
|
|
599
|
+
delayMs?: number;
|
|
600
|
+
} | {
|
|
601
|
+
kind: 'hover';
|
|
602
|
+
ref?: string;
|
|
603
|
+
selector?: string;
|
|
604
|
+
targetId?: string;
|
|
605
|
+
timeoutMs?: number;
|
|
606
|
+
} | {
|
|
607
|
+
kind: 'scrollIntoView';
|
|
608
|
+
ref?: string;
|
|
609
|
+
selector?: string;
|
|
610
|
+
targetId?: string;
|
|
611
|
+
timeoutMs?: number;
|
|
612
|
+
} | {
|
|
613
|
+
kind: 'drag';
|
|
614
|
+
startRef?: string;
|
|
615
|
+
startSelector?: string;
|
|
616
|
+
endRef?: string;
|
|
617
|
+
endSelector?: string;
|
|
618
|
+
targetId?: string;
|
|
619
|
+
timeoutMs?: number;
|
|
620
|
+
} | {
|
|
621
|
+
kind: 'select';
|
|
622
|
+
ref?: string;
|
|
623
|
+
selector?: string;
|
|
624
|
+
values: string[];
|
|
625
|
+
targetId?: string;
|
|
626
|
+
timeoutMs?: number;
|
|
627
|
+
} | {
|
|
628
|
+
kind: 'fill';
|
|
629
|
+
fields: {
|
|
630
|
+
ref: string;
|
|
631
|
+
type?: string;
|
|
632
|
+
value?: string | number | boolean;
|
|
633
|
+
}[];
|
|
634
|
+
targetId?: string;
|
|
635
|
+
timeoutMs?: number;
|
|
636
|
+
} | {
|
|
637
|
+
kind: 'resize';
|
|
638
|
+
width: number;
|
|
639
|
+
height: number;
|
|
640
|
+
targetId?: string;
|
|
641
|
+
} | {
|
|
642
|
+
kind: 'wait';
|
|
643
|
+
timeMs?: number;
|
|
644
|
+
text?: string;
|
|
645
|
+
textGone?: string;
|
|
646
|
+
selector?: string;
|
|
647
|
+
url?: string;
|
|
648
|
+
loadState?: 'load' | 'domcontentloaded' | 'networkidle';
|
|
649
|
+
fn?: string;
|
|
650
|
+
arg?: unknown;
|
|
651
|
+
targetId?: string;
|
|
652
|
+
timeoutMs?: number;
|
|
653
|
+
} | {
|
|
654
|
+
kind: 'evaluate';
|
|
655
|
+
fn: string;
|
|
656
|
+
ref?: string;
|
|
657
|
+
targetId?: string;
|
|
658
|
+
timeoutMs?: number;
|
|
659
|
+
} | {
|
|
660
|
+
kind: 'close';
|
|
661
|
+
targetId?: string;
|
|
662
|
+
} | {
|
|
663
|
+
kind: 'batch';
|
|
664
|
+
actions: BatchAction[];
|
|
665
|
+
targetId?: string;
|
|
666
|
+
stopOnError?: boolean;
|
|
667
|
+
};
|
|
668
|
+
/** Result of a single action within a batch. */
|
|
669
|
+
type BatchActionResult = {
|
|
670
|
+
ok: true;
|
|
671
|
+
} | {
|
|
672
|
+
ok: false;
|
|
673
|
+
error: string;
|
|
674
|
+
};
|
|
675
|
+
/**
|
|
676
|
+
* Execute a single batch action.
|
|
677
|
+
*/
|
|
678
|
+
declare function executeSingleAction(action: BatchAction, cdpUrl: string, targetId: string | undefined, evaluateEnabled: boolean, depth?: number, ssrfPolicy?: SsrfPolicy): Promise<void>;
|
|
679
|
+
/**
|
|
680
|
+
* Execute multiple browser actions in sequence.
|
|
681
|
+
*
|
|
682
|
+
* @param opts.actions - Array of actions to execute
|
|
683
|
+
* @param opts.stopOnError - Stop on first error (default: true)
|
|
684
|
+
* @param opts.evaluateEnabled - Whether evaluate/wait:fn actions are permitted
|
|
685
|
+
* @param opts.depth - Internal recursion depth (do not set manually)
|
|
686
|
+
*/
|
|
687
|
+
declare function batchViaPlaywright(opts: {
|
|
688
|
+
cdpUrl: string;
|
|
689
|
+
targetId?: string;
|
|
690
|
+
actions: BatchAction[];
|
|
691
|
+
stopOnError?: boolean;
|
|
692
|
+
evaluateEnabled?: boolean;
|
|
693
|
+
depth?: number;
|
|
694
|
+
ssrfPolicy?: SsrfPolicy;
|
|
695
|
+
}): Promise<{
|
|
696
|
+
results: BatchActionResult[];
|
|
697
|
+
}>;
|
|
698
|
+
|
|
699
|
+
interface FrameEvalResult {
|
|
700
|
+
frameUrl: string;
|
|
701
|
+
frameName: string;
|
|
702
|
+
result: unknown;
|
|
703
|
+
}
|
|
704
|
+
|
|
704
705
|
/**
|
|
705
706
|
* Represents a single browser page/tab with ref-based automation.
|
|
706
707
|
*
|
|
@@ -1775,9 +1776,9 @@ declare class BrowserClaw {
|
|
|
1775
1776
|
* Convert a WebSocket CDP URL to an HTTP base URL for `/json/*` endpoints.
|
|
1776
1777
|
*/
|
|
1777
1778
|
declare function normalizeCdpHttpBaseForJsonEndpoints(cdpUrl: string): string;
|
|
1778
|
-
declare function isChromeReachable(cdpUrl: string, timeoutMs?: number, authToken?: string): Promise<boolean>;
|
|
1779
|
-
declare function getChromeWebSocketUrl(cdpUrl: string, timeoutMs?: number, authToken?: string): Promise<string | null>;
|
|
1780
|
-
declare function isChromeCdpReady(cdpUrl: string, timeoutMs?: number, handshakeTimeoutMs?: number): Promise<boolean>;
|
|
1779
|
+
declare function isChromeReachable(cdpUrl: string, timeoutMs?: number, authToken?: string, ssrfPolicy?: SsrfPolicy): Promise<boolean>;
|
|
1780
|
+
declare function getChromeWebSocketUrl(cdpUrl: string, timeoutMs?: number, authToken?: string, ssrfPolicy?: SsrfPolicy): Promise<string | null>;
|
|
1781
|
+
declare function isChromeCdpReady(cdpUrl: string, timeoutMs?: number, handshakeTimeoutMs?: number, ssrfPolicy?: SsrfPolicy): Promise<boolean>;
|
|
1781
1782
|
|
|
1782
1783
|
type LookupFn = typeof lookup$1;
|
|
1783
1784
|
/**
|
|
@@ -1971,6 +1972,7 @@ declare const forceDisconnectPlaywrightForTarget: typeof forceDisconnectPlaywrig
|
|
|
1971
1972
|
declare function resolvePageByTargetIdOrThrow(opts: {
|
|
1972
1973
|
cdpUrl: string;
|
|
1973
1974
|
targetId: string;
|
|
1975
|
+
ssrfPolicy?: SsrfPolicy;
|
|
1974
1976
|
}): Promise<Page>;
|
|
1975
1977
|
/**
|
|
1976
1978
|
* Get a page for a target, ensuring page state is initialized.
|
|
@@ -1978,6 +1980,7 @@ declare function resolvePageByTargetIdOrThrow(opts: {
|
|
|
1978
1980
|
declare function getRestoredPageForTarget(opts: {
|
|
1979
1981
|
cdpUrl: string;
|
|
1980
1982
|
targetId?: string;
|
|
1983
|
+
ssrfPolicy?: SsrfPolicy;
|
|
1981
1984
|
}): Promise<Page>;
|
|
1982
1985
|
|
|
1983
1986
|
declare function pressAndHoldViaCdp(opts: {
|
|
@@ -1987,6 +1990,7 @@ declare function pressAndHoldViaCdp(opts: {
|
|
|
1987
1990
|
y: number;
|
|
1988
1991
|
delay?: number;
|
|
1989
1992
|
holdMs?: number;
|
|
1993
|
+
ssrfPolicy?: SsrfPolicy;
|
|
1990
1994
|
}): Promise<void>;
|
|
1991
1995
|
|
|
1992
1996
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2,135 +2,6 @@ import { BrowserContext, Page, Locator, CDPSession } from 'playwright-core';
|
|
|
2
2
|
import { lookup } from 'node:dns';
|
|
3
3
|
import { lookup as lookup$1 } from 'node:dns/promises';
|
|
4
4
|
|
|
5
|
-
/** A single action within a batch. */
|
|
6
|
-
type BatchAction = {
|
|
7
|
-
kind: 'click';
|
|
8
|
-
ref?: string;
|
|
9
|
-
selector?: string;
|
|
10
|
-
targetId?: string;
|
|
11
|
-
doubleClick?: boolean;
|
|
12
|
-
button?: string;
|
|
13
|
-
modifiers?: string[];
|
|
14
|
-
delayMs?: number;
|
|
15
|
-
timeoutMs?: number;
|
|
16
|
-
} | {
|
|
17
|
-
kind: 'type';
|
|
18
|
-
ref?: string;
|
|
19
|
-
selector?: string;
|
|
20
|
-
text: string;
|
|
21
|
-
targetId?: string;
|
|
22
|
-
submit?: boolean;
|
|
23
|
-
slowly?: boolean;
|
|
24
|
-
timeoutMs?: number;
|
|
25
|
-
} | {
|
|
26
|
-
kind: 'press';
|
|
27
|
-
key: string;
|
|
28
|
-
targetId?: string;
|
|
29
|
-
delayMs?: number;
|
|
30
|
-
} | {
|
|
31
|
-
kind: 'hover';
|
|
32
|
-
ref?: string;
|
|
33
|
-
selector?: string;
|
|
34
|
-
targetId?: string;
|
|
35
|
-
timeoutMs?: number;
|
|
36
|
-
} | {
|
|
37
|
-
kind: 'scrollIntoView';
|
|
38
|
-
ref?: string;
|
|
39
|
-
selector?: string;
|
|
40
|
-
targetId?: string;
|
|
41
|
-
timeoutMs?: number;
|
|
42
|
-
} | {
|
|
43
|
-
kind: 'drag';
|
|
44
|
-
startRef?: string;
|
|
45
|
-
startSelector?: string;
|
|
46
|
-
endRef?: string;
|
|
47
|
-
endSelector?: string;
|
|
48
|
-
targetId?: string;
|
|
49
|
-
timeoutMs?: number;
|
|
50
|
-
} | {
|
|
51
|
-
kind: 'select';
|
|
52
|
-
ref?: string;
|
|
53
|
-
selector?: string;
|
|
54
|
-
values: string[];
|
|
55
|
-
targetId?: string;
|
|
56
|
-
timeoutMs?: number;
|
|
57
|
-
} | {
|
|
58
|
-
kind: 'fill';
|
|
59
|
-
fields: {
|
|
60
|
-
ref: string;
|
|
61
|
-
type?: string;
|
|
62
|
-
value?: string | number | boolean;
|
|
63
|
-
}[];
|
|
64
|
-
targetId?: string;
|
|
65
|
-
timeoutMs?: number;
|
|
66
|
-
} | {
|
|
67
|
-
kind: 'resize';
|
|
68
|
-
width: number;
|
|
69
|
-
height: number;
|
|
70
|
-
targetId?: string;
|
|
71
|
-
} | {
|
|
72
|
-
kind: 'wait';
|
|
73
|
-
timeMs?: number;
|
|
74
|
-
text?: string;
|
|
75
|
-
textGone?: string;
|
|
76
|
-
selector?: string;
|
|
77
|
-
url?: string;
|
|
78
|
-
loadState?: 'load' | 'domcontentloaded' | 'networkidle';
|
|
79
|
-
fn?: string;
|
|
80
|
-
arg?: unknown;
|
|
81
|
-
targetId?: string;
|
|
82
|
-
timeoutMs?: number;
|
|
83
|
-
} | {
|
|
84
|
-
kind: 'evaluate';
|
|
85
|
-
fn: string;
|
|
86
|
-
ref?: string;
|
|
87
|
-
targetId?: string;
|
|
88
|
-
timeoutMs?: number;
|
|
89
|
-
} | {
|
|
90
|
-
kind: 'close';
|
|
91
|
-
targetId?: string;
|
|
92
|
-
} | {
|
|
93
|
-
kind: 'batch';
|
|
94
|
-
actions: BatchAction[];
|
|
95
|
-
targetId?: string;
|
|
96
|
-
stopOnError?: boolean;
|
|
97
|
-
};
|
|
98
|
-
/** Result of a single action within a batch. */
|
|
99
|
-
type BatchActionResult = {
|
|
100
|
-
ok: true;
|
|
101
|
-
} | {
|
|
102
|
-
ok: false;
|
|
103
|
-
error: string;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Execute a single batch action.
|
|
107
|
-
*/
|
|
108
|
-
declare function executeSingleAction(action: BatchAction, cdpUrl: string, targetId: string | undefined, evaluateEnabled: boolean, depth?: number): Promise<void>;
|
|
109
|
-
/**
|
|
110
|
-
* Execute multiple browser actions in sequence.
|
|
111
|
-
*
|
|
112
|
-
* @param opts.actions - Array of actions to execute
|
|
113
|
-
* @param opts.stopOnError - Stop on first error (default: true)
|
|
114
|
-
* @param opts.evaluateEnabled - Whether evaluate/wait:fn actions are permitted
|
|
115
|
-
* @param opts.depth - Internal recursion depth (do not set manually)
|
|
116
|
-
*/
|
|
117
|
-
declare function batchViaPlaywright(opts: {
|
|
118
|
-
cdpUrl: string;
|
|
119
|
-
targetId?: string;
|
|
120
|
-
actions: BatchAction[];
|
|
121
|
-
stopOnError?: boolean;
|
|
122
|
-
evaluateEnabled?: boolean;
|
|
123
|
-
depth?: number;
|
|
124
|
-
}): Promise<{
|
|
125
|
-
results: BatchActionResult[];
|
|
126
|
-
}>;
|
|
127
|
-
|
|
128
|
-
interface FrameEvalResult {
|
|
129
|
-
frameUrl: string;
|
|
130
|
-
frameName: string;
|
|
131
|
-
result: unknown;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
5
|
/**
|
|
135
6
|
* Policy for controlling which URLs browser navigation is allowed to reach.
|
|
136
7
|
* Defaults to trusted-network mode (private/internal addresses allowed).
|
|
@@ -701,6 +572,136 @@ interface PinnedHostname {
|
|
|
701
572
|
lookup: typeof lookup;
|
|
702
573
|
}
|
|
703
574
|
|
|
575
|
+
/** A single action within a batch. */
|
|
576
|
+
type BatchAction = {
|
|
577
|
+
kind: 'click';
|
|
578
|
+
ref?: string;
|
|
579
|
+
selector?: string;
|
|
580
|
+
targetId?: string;
|
|
581
|
+
doubleClick?: boolean;
|
|
582
|
+
button?: string;
|
|
583
|
+
modifiers?: string[];
|
|
584
|
+
delayMs?: number;
|
|
585
|
+
timeoutMs?: number;
|
|
586
|
+
} | {
|
|
587
|
+
kind: 'type';
|
|
588
|
+
ref?: string;
|
|
589
|
+
selector?: string;
|
|
590
|
+
text: string;
|
|
591
|
+
targetId?: string;
|
|
592
|
+
submit?: boolean;
|
|
593
|
+
slowly?: boolean;
|
|
594
|
+
timeoutMs?: number;
|
|
595
|
+
} | {
|
|
596
|
+
kind: 'press';
|
|
597
|
+
key: string;
|
|
598
|
+
targetId?: string;
|
|
599
|
+
delayMs?: number;
|
|
600
|
+
} | {
|
|
601
|
+
kind: 'hover';
|
|
602
|
+
ref?: string;
|
|
603
|
+
selector?: string;
|
|
604
|
+
targetId?: string;
|
|
605
|
+
timeoutMs?: number;
|
|
606
|
+
} | {
|
|
607
|
+
kind: 'scrollIntoView';
|
|
608
|
+
ref?: string;
|
|
609
|
+
selector?: string;
|
|
610
|
+
targetId?: string;
|
|
611
|
+
timeoutMs?: number;
|
|
612
|
+
} | {
|
|
613
|
+
kind: 'drag';
|
|
614
|
+
startRef?: string;
|
|
615
|
+
startSelector?: string;
|
|
616
|
+
endRef?: string;
|
|
617
|
+
endSelector?: string;
|
|
618
|
+
targetId?: string;
|
|
619
|
+
timeoutMs?: number;
|
|
620
|
+
} | {
|
|
621
|
+
kind: 'select';
|
|
622
|
+
ref?: string;
|
|
623
|
+
selector?: string;
|
|
624
|
+
values: string[];
|
|
625
|
+
targetId?: string;
|
|
626
|
+
timeoutMs?: number;
|
|
627
|
+
} | {
|
|
628
|
+
kind: 'fill';
|
|
629
|
+
fields: {
|
|
630
|
+
ref: string;
|
|
631
|
+
type?: string;
|
|
632
|
+
value?: string | number | boolean;
|
|
633
|
+
}[];
|
|
634
|
+
targetId?: string;
|
|
635
|
+
timeoutMs?: number;
|
|
636
|
+
} | {
|
|
637
|
+
kind: 'resize';
|
|
638
|
+
width: number;
|
|
639
|
+
height: number;
|
|
640
|
+
targetId?: string;
|
|
641
|
+
} | {
|
|
642
|
+
kind: 'wait';
|
|
643
|
+
timeMs?: number;
|
|
644
|
+
text?: string;
|
|
645
|
+
textGone?: string;
|
|
646
|
+
selector?: string;
|
|
647
|
+
url?: string;
|
|
648
|
+
loadState?: 'load' | 'domcontentloaded' | 'networkidle';
|
|
649
|
+
fn?: string;
|
|
650
|
+
arg?: unknown;
|
|
651
|
+
targetId?: string;
|
|
652
|
+
timeoutMs?: number;
|
|
653
|
+
} | {
|
|
654
|
+
kind: 'evaluate';
|
|
655
|
+
fn: string;
|
|
656
|
+
ref?: string;
|
|
657
|
+
targetId?: string;
|
|
658
|
+
timeoutMs?: number;
|
|
659
|
+
} | {
|
|
660
|
+
kind: 'close';
|
|
661
|
+
targetId?: string;
|
|
662
|
+
} | {
|
|
663
|
+
kind: 'batch';
|
|
664
|
+
actions: BatchAction[];
|
|
665
|
+
targetId?: string;
|
|
666
|
+
stopOnError?: boolean;
|
|
667
|
+
};
|
|
668
|
+
/** Result of a single action within a batch. */
|
|
669
|
+
type BatchActionResult = {
|
|
670
|
+
ok: true;
|
|
671
|
+
} | {
|
|
672
|
+
ok: false;
|
|
673
|
+
error: string;
|
|
674
|
+
};
|
|
675
|
+
/**
|
|
676
|
+
* Execute a single batch action.
|
|
677
|
+
*/
|
|
678
|
+
declare function executeSingleAction(action: BatchAction, cdpUrl: string, targetId: string | undefined, evaluateEnabled: boolean, depth?: number, ssrfPolicy?: SsrfPolicy): Promise<void>;
|
|
679
|
+
/**
|
|
680
|
+
* Execute multiple browser actions in sequence.
|
|
681
|
+
*
|
|
682
|
+
* @param opts.actions - Array of actions to execute
|
|
683
|
+
* @param opts.stopOnError - Stop on first error (default: true)
|
|
684
|
+
* @param opts.evaluateEnabled - Whether evaluate/wait:fn actions are permitted
|
|
685
|
+
* @param opts.depth - Internal recursion depth (do not set manually)
|
|
686
|
+
*/
|
|
687
|
+
declare function batchViaPlaywright(opts: {
|
|
688
|
+
cdpUrl: string;
|
|
689
|
+
targetId?: string;
|
|
690
|
+
actions: BatchAction[];
|
|
691
|
+
stopOnError?: boolean;
|
|
692
|
+
evaluateEnabled?: boolean;
|
|
693
|
+
depth?: number;
|
|
694
|
+
ssrfPolicy?: SsrfPolicy;
|
|
695
|
+
}): Promise<{
|
|
696
|
+
results: BatchActionResult[];
|
|
697
|
+
}>;
|
|
698
|
+
|
|
699
|
+
interface FrameEvalResult {
|
|
700
|
+
frameUrl: string;
|
|
701
|
+
frameName: string;
|
|
702
|
+
result: unknown;
|
|
703
|
+
}
|
|
704
|
+
|
|
704
705
|
/**
|
|
705
706
|
* Represents a single browser page/tab with ref-based automation.
|
|
706
707
|
*
|
|
@@ -1775,9 +1776,9 @@ declare class BrowserClaw {
|
|
|
1775
1776
|
* Convert a WebSocket CDP URL to an HTTP base URL for `/json/*` endpoints.
|
|
1776
1777
|
*/
|
|
1777
1778
|
declare function normalizeCdpHttpBaseForJsonEndpoints(cdpUrl: string): string;
|
|
1778
|
-
declare function isChromeReachable(cdpUrl: string, timeoutMs?: number, authToken?: string): Promise<boolean>;
|
|
1779
|
-
declare function getChromeWebSocketUrl(cdpUrl: string, timeoutMs?: number, authToken?: string): Promise<string | null>;
|
|
1780
|
-
declare function isChromeCdpReady(cdpUrl: string, timeoutMs?: number, handshakeTimeoutMs?: number): Promise<boolean>;
|
|
1779
|
+
declare function isChromeReachable(cdpUrl: string, timeoutMs?: number, authToken?: string, ssrfPolicy?: SsrfPolicy): Promise<boolean>;
|
|
1780
|
+
declare function getChromeWebSocketUrl(cdpUrl: string, timeoutMs?: number, authToken?: string, ssrfPolicy?: SsrfPolicy): Promise<string | null>;
|
|
1781
|
+
declare function isChromeCdpReady(cdpUrl: string, timeoutMs?: number, handshakeTimeoutMs?: number, ssrfPolicy?: SsrfPolicy): Promise<boolean>;
|
|
1781
1782
|
|
|
1782
1783
|
type LookupFn = typeof lookup$1;
|
|
1783
1784
|
/**
|
|
@@ -1971,6 +1972,7 @@ declare const forceDisconnectPlaywrightForTarget: typeof forceDisconnectPlaywrig
|
|
|
1971
1972
|
declare function resolvePageByTargetIdOrThrow(opts: {
|
|
1972
1973
|
cdpUrl: string;
|
|
1973
1974
|
targetId: string;
|
|
1975
|
+
ssrfPolicy?: SsrfPolicy;
|
|
1974
1976
|
}): Promise<Page>;
|
|
1975
1977
|
/**
|
|
1976
1978
|
* Get a page for a target, ensuring page state is initialized.
|
|
@@ -1978,6 +1980,7 @@ declare function resolvePageByTargetIdOrThrow(opts: {
|
|
|
1978
1980
|
declare function getRestoredPageForTarget(opts: {
|
|
1979
1981
|
cdpUrl: string;
|
|
1980
1982
|
targetId?: string;
|
|
1983
|
+
ssrfPolicy?: SsrfPolicy;
|
|
1981
1984
|
}): Promise<Page>;
|
|
1982
1985
|
|
|
1983
1986
|
declare function pressAndHoldViaCdp(opts: {
|
|
@@ -1987,6 +1990,7 @@ declare function pressAndHoldViaCdp(opts: {
|
|
|
1987
1990
|
y: number;
|
|
1988
1991
|
delay?: number;
|
|
1989
1992
|
holdMs?: number;
|
|
1993
|
+
ssrfPolicy?: SsrfPolicy;
|
|
1990
1994
|
}): Promise<void>;
|
|
1991
1995
|
|
|
1992
1996
|
/**
|