@xbrowser/cli 1.9.7 → 1.9.9
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/{anti-bot-MCVM6IFB.js → anti-bot-DR56Y63V.js} +1 -1
- package/dist/{browser-JXIJF4VL.js → browser-FFYPFTBV.js} +1 -1
- package/dist/{browser-ALPLJNH2.js → browser-RHWUAMTB.js} +2 -2
- package/dist/{browser-ZPQP6VW7.js → browser-YCO4GJMZ.js} +2 -2
- package/dist/{cdp-driver-MI7VCE44.js → cdp-driver-2T4P4ZE2.js} +103 -2
- package/dist/{cdp-driver-6EVYLHL2.js → cdp-driver-J3YQ4LJV.js} +1 -1
- package/dist/chunk-3OD76SUE.js +20 -0
- package/dist/chunk-43TEMG4U.js +9 -0
- package/dist/{chunk-CH5ZQV64.js → chunk-4452SPFI.js} +928 -18
- package/dist/{chunk-C4O73DQL.js → chunk-5UGR6MUK.js} +928 -18
- package/dist/{chunk-37SHZSUR.js → chunk-6OZWKXSW.js} +15 -16
- package/dist/{chunk-7ZDWM6T2.js → chunk-BNO7OKO4.js} +5 -6
- package/dist/{chunk-24SY6PE5.js → chunk-CG3D3CHY.js} +1 -8
- package/dist/{chunk-ZJHQPMCY.js → chunk-DWDXEGVK.js} +5 -6
- package/dist/{chunk-74S7UUI2.js → chunk-GUTBIYFW.js} +117 -17
- package/dist/{chunk-DPJNCMLC.js → chunk-INTQPBYF.js} +7 -0
- package/dist/{human-interaction-OU7LZ6OZ.js → chunk-MWFHZUIY.js} +6 -7
- package/dist/chunk-Q2DFJQGS.js +128 -0
- package/dist/{chunk-VJNMAWPZ.js → chunk-RRBXV7KE.js} +103 -2
- package/dist/{chunk-5JSOGINQ.js → chunk-RZM5CNIY.js} +15 -16
- package/dist/{human-interaction-HJTXFVQS.js → chunk-SQHSZENE.js} +2 -2
- package/dist/chunk-TZPKFUBT.js +20 -0
- package/dist/{chunk-YAUG3NSI.js → chunk-YMUSHPU4.js} +16 -128
- package/dist/cli.js +41 -28
- package/dist/{daemon-client-4HJENICO.js → daemon-client-GKEPT4NY.js} +15 -3
- package/dist/{daemon-client-CMRAWXTN.js → daemon-client-O6BYVRXV.js} +4 -1
- package/dist/daemon-main.js +661 -70
- package/dist/human-interaction-5AO42MBA.js +8 -0
- package/dist/{human-interaction-2DZK4MW7.js → human-interaction-C5OEGXGO.js} +1 -1
- package/dist/human-interaction-ISXZTAYY.js +8 -0
- package/dist/index.d.ts +172 -2
- package/dist/index.js +173 -63
- package/dist/recovery-EF33LKRJ.js +77 -0
- package/dist/recovery-J2ISVGUL.js +77 -0
- package/dist/recovery-ZJVVHP7N.js +76 -0
- package/dist/{session-recorder-7GXI42FO.js → session-recorder-H3KEYU26.js} +1 -1
- package/dist/{session-recorder-RFOPX4SF.js → session-recorder-QRZMKFVL.js} +1 -1
- package/dist/{session-replayer-3HEIJBJ2.js → session-replayer-LJUC4TI7.js} +25 -8
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ var SessionReplayer = class {
|
|
|
31
31
|
if (this.opts.page) {
|
|
32
32
|
this.page = this.opts.page;
|
|
33
33
|
} else if (this.opts.cdpUrl) {
|
|
34
|
-
const { launch } = await import("./cdp-driver-
|
|
34
|
+
const { launch } = await import("./cdp-driver-J3YQ4LJV.js");
|
|
35
35
|
const { browser } = await launch({ cdpEndpoint: this.opts.cdpUrl });
|
|
36
36
|
let contexts = browser.contexts();
|
|
37
37
|
for (let i = 0; i < 10 && contexts.length === 0; i++) {
|
|
@@ -65,7 +65,7 @@ var SessionReplayer = class {
|
|
|
65
65
|
success++;
|
|
66
66
|
} catch (e) {
|
|
67
67
|
const err = e instanceof Error ? e : new Error(String(e));
|
|
68
|
-
this.opts.onError?.(action, err);
|
|
68
|
+
this.opts.onError?.(action, err, i);
|
|
69
69
|
failed++;
|
|
70
70
|
}
|
|
71
71
|
if (i < actions.length - 1) {
|
|
@@ -79,6 +79,11 @@ var SessionReplayer = class {
|
|
|
79
79
|
const page = this.page;
|
|
80
80
|
const timeout = this.opts.stepTimeout;
|
|
81
81
|
switch (action.type) {
|
|
82
|
+
// Proactive sensing actions are observations, not user actions — skip
|
|
83
|
+
// them during replay (they don't represent anything the user did).
|
|
84
|
+
case "popup_appear":
|
|
85
|
+
case "discovered_filters":
|
|
86
|
+
return;
|
|
82
87
|
case "navigation":
|
|
83
88
|
await page.goto(action.url, { waitUntil: "load", timeout });
|
|
84
89
|
break;
|
|
@@ -153,7 +158,19 @@ var SessionReplayer = class {
|
|
|
153
158
|
}
|
|
154
159
|
case "hover": {
|
|
155
160
|
const selector = await this.resolveAndWait(action);
|
|
156
|
-
|
|
161
|
+
if (selector) {
|
|
162
|
+
await page.hover(selector);
|
|
163
|
+
}
|
|
164
|
+
const firstPopup = action.hoverContext?.appeared?.[0];
|
|
165
|
+
if (firstPopup?.selector) {
|
|
166
|
+
try {
|
|
167
|
+
await page.waitForSelector(firstPopup.selector, {
|
|
168
|
+
state: "visible",
|
|
169
|
+
timeout: 1e3
|
|
170
|
+
});
|
|
171
|
+
} catch {
|
|
172
|
+
}
|
|
173
|
+
}
|
|
157
174
|
break;
|
|
158
175
|
}
|
|
159
176
|
case "drag": {
|
|
@@ -257,7 +274,9 @@ var SessionReplayer = class {
|
|
|
257
274
|
* Returns the first matching selector, or throws if none match.
|
|
258
275
|
* Fallback order:
|
|
259
276
|
* 1. Primary CSS selector (always tried first)
|
|
260
|
-
* 2. textFallback selector (
|
|
277
|
+
* 2. textFallback selector (used when primary fails — not just for low
|
|
278
|
+
* confidence, since high-confidence selectors from dynamic attributes
|
|
279
|
+
* like data-spm-anchor-id can also fail on replay)
|
|
261
280
|
* 3. Tag-based fallback (last resort)
|
|
262
281
|
*/
|
|
263
282
|
async resolveAndWait(action) {
|
|
@@ -267,10 +286,8 @@ var SessionReplayer = class {
|
|
|
267
286
|
const timeout = this.opts.stepTimeout;
|
|
268
287
|
const candidates = [];
|
|
269
288
|
if (el.selector) candidates.push(el.selector);
|
|
270
|
-
if (el.
|
|
271
|
-
|
|
272
|
-
candidates.push(el.textFallback.selector);
|
|
273
|
-
}
|
|
289
|
+
if (el.textFallback?.selector && !candidates.includes(el.textFallback.selector)) {
|
|
290
|
+
candidates.push(el.textFallback.selector);
|
|
274
291
|
}
|
|
275
292
|
if (el.tag && !candidates.includes(el.tag)) {
|
|
276
293
|
candidates.push(el.tag);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xbrowser/cli",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.9",
|
|
4
4
|
"description": "Browser automation CLI for web scraping, headless browsing, SEO analysis, and AI agent workflows. A command-line alternative to Playwright, Puppeteer, and Selenium.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|