browserclaw 0.9.2 → 0.9.3
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.cjs +2 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -19
- package/dist/index.d.ts +0 -19
- package/dist/index.js +2 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -717,25 +717,6 @@ declare class CrawlPage {
|
|
|
717
717
|
clickCount?: number;
|
|
718
718
|
delayMs?: number;
|
|
719
719
|
}): Promise<void>;
|
|
720
|
-
/**
|
|
721
|
-
* Press and hold at page coordinates using raw CDP events.
|
|
722
|
-
*
|
|
723
|
-
* Bypasses Playwright's automation layer by dispatching CDP
|
|
724
|
-
* `Input.dispatchMouseEvent` directly — useful for anti-bot challenges
|
|
725
|
-
* that detect automated clicks.
|
|
726
|
-
*
|
|
727
|
-
* @param x - X coordinate in CSS pixels
|
|
728
|
-
* @param y - Y coordinate in CSS pixels
|
|
729
|
-
* @param opts - Options (holdMs: hold duration, default 1000, max 30000)
|
|
730
|
-
*
|
|
731
|
-
* @example
|
|
732
|
-
* ```ts
|
|
733
|
-
* await page.pressAndHold(400, 300, { holdMs: 5000 });
|
|
734
|
-
* ```
|
|
735
|
-
*/
|
|
736
|
-
pressAndHold(x: number, y: number, opts?: {
|
|
737
|
-
holdMs?: number;
|
|
738
|
-
}): Promise<void>;
|
|
739
720
|
/**
|
|
740
721
|
* Click an element by its visible text content (no snapshot/ref needed).
|
|
741
722
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -717,25 +717,6 @@ declare class CrawlPage {
|
|
|
717
717
|
clickCount?: number;
|
|
718
718
|
delayMs?: number;
|
|
719
719
|
}): Promise<void>;
|
|
720
|
-
/**
|
|
721
|
-
* Press and hold at page coordinates using raw CDP events.
|
|
722
|
-
*
|
|
723
|
-
* Bypasses Playwright's automation layer by dispatching CDP
|
|
724
|
-
* `Input.dispatchMouseEvent` directly — useful for anti-bot challenges
|
|
725
|
-
* that detect automated clicks.
|
|
726
|
-
*
|
|
727
|
-
* @param x - X coordinate in CSS pixels
|
|
728
|
-
* @param y - Y coordinate in CSS pixels
|
|
729
|
-
* @param opts - Options (holdMs: hold duration, default 1000, max 30000)
|
|
730
|
-
*
|
|
731
|
-
* @example
|
|
732
|
-
* ```ts
|
|
733
|
-
* await page.pressAndHold(400, 300, { holdMs: 5000 });
|
|
734
|
-
* ```
|
|
735
|
-
*/
|
|
736
|
-
pressAndHold(x: number, y: number, opts?: {
|
|
737
|
-
holdMs?: number;
|
|
738
|
-
}): Promise<void>;
|
|
739
720
|
/**
|
|
740
721
|
* Click an element by its visible text content (no snapshot/ref needed).
|
|
741
722
|
*
|
package/dist/index.js
CHANGED
|
@@ -37,9 +37,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
37
|
mod
|
|
38
38
|
));
|
|
39
39
|
|
|
40
|
-
// node_modules/ipaddr.js/lib/ipaddr.js
|
|
40
|
+
// ../../../node_modules/ipaddr.js/lib/ipaddr.js
|
|
41
41
|
var require_ipaddr = __commonJS({
|
|
42
|
-
"node_modules/ipaddr.js/lib/ipaddr.js"(exports$1, module) {
|
|
42
|
+
"../../../node_modules/ipaddr.js/lib/ipaddr.js"(exports$1, module) {
|
|
43
43
|
(function(root) {
|
|
44
44
|
const ipv4Part = "(0?\\d+|0x[a-f0-9]+)";
|
|
45
45
|
const ipv4Regexes = {
|
|
@@ -1377,7 +1377,6 @@ async function launchChrome(opts = {}) {
|
|
|
1377
1377
|
const spawnChrome = () => {
|
|
1378
1378
|
const args = [
|
|
1379
1379
|
`--remote-debugging-port=${String(cdpPort)}`,
|
|
1380
|
-
"--remote-debugging-address=127.0.0.1",
|
|
1381
1380
|
`--user-data-dir=${userDataDir}`,
|
|
1382
1381
|
"--no-first-run",
|
|
1383
1382
|
"--no-default-browser-check",
|
|
@@ -3068,25 +3067,6 @@ async function mouseClickViaPlaywright(opts) {
|
|
|
3068
3067
|
delay: opts.delayMs
|
|
3069
3068
|
});
|
|
3070
3069
|
}
|
|
3071
|
-
var MAX_HOLD_MS = 3e4;
|
|
3072
|
-
async function pressAndHoldViaCdp(opts) {
|
|
3073
|
-
const holdMs = resolveBoundedDelayMs(opts.holdMs ?? 1e3, "holdMs", MAX_HOLD_MS);
|
|
3074
|
-
const page = await getPageForTargetId({ cdpUrl: opts.cdpUrl, targetId: opts.targetId });
|
|
3075
|
-
ensurePageState(page);
|
|
3076
|
-
const pos = { x: opts.x, y: opts.y };
|
|
3077
|
-
const btn = { button: "left", clickCount: 1 };
|
|
3078
|
-
await withPageScopedCdpClient({
|
|
3079
|
-
cdpUrl: opts.cdpUrl,
|
|
3080
|
-
page,
|
|
3081
|
-
targetId: opts.targetId,
|
|
3082
|
-
fn: async (send) => {
|
|
3083
|
-
await send("Input.dispatchMouseEvent", { type: "mouseMoved", ...pos });
|
|
3084
|
-
await send("Input.dispatchMouseEvent", { type: "mousePressed", ...pos, ...btn });
|
|
3085
|
-
await new Promise((r) => setTimeout(r, holdMs));
|
|
3086
|
-
await send("Input.dispatchMouseEvent", { type: "mouseReleased", ...pos, ...btn });
|
|
3087
|
-
}
|
|
3088
|
-
});
|
|
3089
|
-
}
|
|
3090
3070
|
async function clickByTextViaPlaywright(opts) {
|
|
3091
3071
|
const page = await getRestoredPageForTarget(opts);
|
|
3092
3072
|
const timeout = resolveInteractionTimeoutMs(opts.timeoutMs);
|
|
@@ -4935,31 +4915,6 @@ var CrawlPage = class {
|
|
|
4935
4915
|
delayMs: opts?.delayMs
|
|
4936
4916
|
});
|
|
4937
4917
|
}
|
|
4938
|
-
/**
|
|
4939
|
-
* Press and hold at page coordinates using raw CDP events.
|
|
4940
|
-
*
|
|
4941
|
-
* Bypasses Playwright's automation layer by dispatching CDP
|
|
4942
|
-
* `Input.dispatchMouseEvent` directly — useful for anti-bot challenges
|
|
4943
|
-
* that detect automated clicks.
|
|
4944
|
-
*
|
|
4945
|
-
* @param x - X coordinate in CSS pixels
|
|
4946
|
-
* @param y - Y coordinate in CSS pixels
|
|
4947
|
-
* @param opts - Options (holdMs: hold duration, default 1000, max 30000)
|
|
4948
|
-
*
|
|
4949
|
-
* @example
|
|
4950
|
-
* ```ts
|
|
4951
|
-
* await page.pressAndHold(400, 300, { holdMs: 5000 });
|
|
4952
|
-
* ```
|
|
4953
|
-
*/
|
|
4954
|
-
async pressAndHold(x, y, opts) {
|
|
4955
|
-
return pressAndHoldViaCdp({
|
|
4956
|
-
cdpUrl: this.cdpUrl,
|
|
4957
|
-
targetId: this.targetId,
|
|
4958
|
-
x,
|
|
4959
|
-
y,
|
|
4960
|
-
holdMs: opts?.holdMs
|
|
4961
|
-
});
|
|
4962
|
-
}
|
|
4963
4918
|
/**
|
|
4964
4919
|
* Click an element by its visible text content (no snapshot/ref needed).
|
|
4965
4920
|
*
|