browserscale-ts 1.2.0 → 1.3.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.
- package/README.md +57 -10
- package/dist/browser.d.ts +1 -1
- package/dist/browserscale.browser.js +303 -38
- package/dist/client.d.ts +141 -2
- package/dist/client.js +236 -1
- package/dist/errors.d.ts +33 -6
- package/dist/errors.js +11 -3
- package/dist/gen/wrc_pb.d.ts +559 -3
- package/dist/gen/wrc_pb.js +146 -66
- package/dist/index.d.ts +2 -2
- package/dist/internal/convert.js +20 -0
- package/dist/options.d.ts +31 -0
- package/dist/types.d.ts +59 -0
- package/package.json +1 -1
package/dist/options.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Locator } from "./locator.ts";
|
|
1
2
|
/** Mouse button used by {@link CloudBrowser.click}. */
|
|
2
3
|
export type Button = "left" | "right" | "middle";
|
|
3
4
|
/** Mouse phase performed by {@link CloudBrowser.click}. */
|
|
@@ -24,6 +25,25 @@ export interface ClickOpts {
|
|
|
24
25
|
*/
|
|
25
26
|
action?: ClickAction;
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Optional customization for {@link CloudBrowser.addReaction}. All fields are
|
|
30
|
+
* optional; missing or zero values mean "use the server default".
|
|
31
|
+
*/
|
|
32
|
+
export interface ReactionOpts {
|
|
33
|
+
/**
|
|
34
|
+
* Override the click target. Omit to click the matched element itself.
|
|
35
|
+
* Provide a `css()`/`js()` {@link Locator} to click a different element,
|
|
36
|
+
* resolved in the matched element's frame (e.g. a modal's close "X").
|
|
37
|
+
* `node()`/`at()` locators are rejected.
|
|
38
|
+
*/
|
|
39
|
+
on?: Locator;
|
|
40
|
+
/** Mouse button for the click. Default `"left"`. */
|
|
41
|
+
button?: Button;
|
|
42
|
+
/** `1` = single click (default), `2` = double-click. */
|
|
43
|
+
clickCount?: number;
|
|
44
|
+
/** Poll cadence in milliseconds for the shared page loop. Default 300. */
|
|
45
|
+
intervalMs?: number;
|
|
46
|
+
}
|
|
27
47
|
/**
|
|
28
48
|
* Optional customization for {@link CloudBrowser.fill}. All fields are
|
|
29
49
|
* optional; missing values mean "use the server default".
|
|
@@ -41,6 +61,17 @@ export interface FillOpts {
|
|
|
41
61
|
* in the field.
|
|
42
62
|
*/
|
|
43
63
|
clearFirst?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Budget in ms to make the field focusable+clickable (locate, scroll,
|
|
66
|
+
* settle, un-occlude), mirroring the click timeout. Omit for the server
|
|
67
|
+
* default (5000). `0` makes fill one-shot (no retry).
|
|
68
|
+
*/
|
|
69
|
+
timeoutMs?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Settle window in ms before the focus click, mirroring the click
|
|
72
|
+
* steady-time. Omit for the server default (750). `0` skips settling.
|
|
73
|
+
*/
|
|
74
|
+
steadyMs?: number;
|
|
44
75
|
}
|
|
45
76
|
/**
|
|
46
77
|
* Optional customization for {@link CloudBrowser.selectByIndex},
|
package/dist/types.d.ts
CHANGED
|
@@ -101,6 +101,31 @@ export interface OccluderInfo {
|
|
|
101
101
|
*/
|
|
102
102
|
hittableWhileInvisible: boolean;
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* ElementRef is a lightweight descriptor of an element — enough to identify it
|
|
106
|
+
* (and decide what to do) without another DOM round-trip. It names the element
|
|
107
|
+
* that stole focus in a {@link FillError} focus-loss failure.
|
|
108
|
+
*/
|
|
109
|
+
export interface ElementRef {
|
|
110
|
+
backendNodeId: number;
|
|
111
|
+
/** Upper-case tag name, e.g. "INPUT", "BUTTON", "DIV". */
|
|
112
|
+
tagName: string;
|
|
113
|
+
/** id attribute, if present. */
|
|
114
|
+
id?: string;
|
|
115
|
+
/** name attribute, if present. */
|
|
116
|
+
name?: string;
|
|
117
|
+
/** class attribute, if present. */
|
|
118
|
+
className?: string;
|
|
119
|
+
/** `<input>` type, if the element is an `<input>`. */
|
|
120
|
+
inputType?: string;
|
|
121
|
+
/** Whitespace-collapsed textContent/value snippet (max 120 chars). */
|
|
122
|
+
text?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Whether this element is itself an editable text sink (input / textarea /
|
|
125
|
+
* contenteditable).
|
|
126
|
+
*/
|
|
127
|
+
editable: boolean;
|
|
128
|
+
}
|
|
104
129
|
/**
|
|
105
130
|
* WaitConditionStatus is the per-condition diagnostic carried by
|
|
106
131
|
* {@link WaitError} when a {@link CloudBrowser.wait} times out: one entry per
|
|
@@ -246,3 +271,37 @@ export interface RentResponse {
|
|
|
246
271
|
acceptLanguage: string;
|
|
247
272
|
fingerprint: string;
|
|
248
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* IceServer is one entry for a WebRTC `RTCPeerConnection`'s `iceServers`
|
|
276
|
+
* config: a TURN (or STUN) URL plus the short-lived credentials to
|
|
277
|
+
* authenticate with it. Pass these to your peer before creating the offer.
|
|
278
|
+
*/
|
|
279
|
+
export interface IceServer {
|
|
280
|
+
/** ICE server URLs (e.g. `turn:relay.example.com:3478?transport=udp`). */
|
|
281
|
+
urls: string[];
|
|
282
|
+
/** Short-lived TURN REST username (empty for plain STUN). */
|
|
283
|
+
username: string;
|
|
284
|
+
/** Short-lived TURN REST credential (empty for plain STUN). */
|
|
285
|
+
credential: string;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* ReactionInfo describes a still-pending reaction, as returned by
|
|
289
|
+
* {@link CloudBrowser.listReactions}. One-shot reactions that have already
|
|
290
|
+
* fired are gone and never appear here.
|
|
291
|
+
*/
|
|
292
|
+
export interface ReactionInfo {
|
|
293
|
+
/** Stable id assigned by {@link CloudBrowser.addReaction} (pass to removeReaction). */
|
|
294
|
+
reactionId: string;
|
|
295
|
+
/** Set if the reaction matches by CSS selector. */
|
|
296
|
+
matchSelector: string;
|
|
297
|
+
/** Set if the reaction matches by JS expression. */
|
|
298
|
+
matchJsExpression: string;
|
|
299
|
+
/** Set if the click target differs from the matched element. */
|
|
300
|
+
actionSelector: string;
|
|
301
|
+
/** Set if the click target differs from the matched element. */
|
|
302
|
+
actionJsExpression: string;
|
|
303
|
+
/** Frame scope: `""` for the main frame, a specific frameId, or `AllFrames`. */
|
|
304
|
+
frameId: string;
|
|
305
|
+
/** Whether the match additionally requires the element to be visible. */
|
|
306
|
+
visible: boolean;
|
|
307
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserscale-ts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Official SDK for browserscale — undetected stealth browsers in the cloud. Rent real Chromium sessions with unique fingerprints, built-in proxies, captcha solving, human-like input and live video — scale web scraping and automation without running a single browser yourself.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|