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.cjs
CHANGED
|
@@ -48,9 +48,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
48
48
|
mod
|
|
49
49
|
));
|
|
50
50
|
|
|
51
|
-
// node_modules/ipaddr.js/lib/ipaddr.js
|
|
51
|
+
// ../../../node_modules/ipaddr.js/lib/ipaddr.js
|
|
52
52
|
var require_ipaddr = __commonJS({
|
|
53
|
-
"node_modules/ipaddr.js/lib/ipaddr.js"(exports$1, module) {
|
|
53
|
+
"../../../node_modules/ipaddr.js/lib/ipaddr.js"(exports$1, module) {
|
|
54
54
|
(function(root) {
|
|
55
55
|
const ipv4Part = "(0?\\d+|0x[a-f0-9]+)";
|
|
56
56
|
const ipv4Regexes = {
|
|
@@ -1388,7 +1388,6 @@ async function launchChrome(opts = {}) {
|
|
|
1388
1388
|
const spawnChrome = () => {
|
|
1389
1389
|
const args = [
|
|
1390
1390
|
`--remote-debugging-port=${String(cdpPort)}`,
|
|
1391
|
-
"--remote-debugging-address=127.0.0.1",
|
|
1392
1391
|
`--user-data-dir=${userDataDir}`,
|
|
1393
1392
|
"--no-first-run",
|
|
1394
1393
|
"--no-default-browser-check",
|
|
@@ -3079,25 +3078,6 @@ async function mouseClickViaPlaywright(opts) {
|
|
|
3079
3078
|
delay: opts.delayMs
|
|
3080
3079
|
});
|
|
3081
3080
|
}
|
|
3082
|
-
var MAX_HOLD_MS = 3e4;
|
|
3083
|
-
async function pressAndHoldViaCdp(opts) {
|
|
3084
|
-
const holdMs = resolveBoundedDelayMs(opts.holdMs ?? 1e3, "holdMs", MAX_HOLD_MS);
|
|
3085
|
-
const page = await getPageForTargetId({ cdpUrl: opts.cdpUrl, targetId: opts.targetId });
|
|
3086
|
-
ensurePageState(page);
|
|
3087
|
-
const pos = { x: opts.x, y: opts.y };
|
|
3088
|
-
const btn = { button: "left", clickCount: 1 };
|
|
3089
|
-
await withPageScopedCdpClient({
|
|
3090
|
-
cdpUrl: opts.cdpUrl,
|
|
3091
|
-
page,
|
|
3092
|
-
targetId: opts.targetId,
|
|
3093
|
-
fn: async (send) => {
|
|
3094
|
-
await send("Input.dispatchMouseEvent", { type: "mouseMoved", ...pos });
|
|
3095
|
-
await send("Input.dispatchMouseEvent", { type: "mousePressed", ...pos, ...btn });
|
|
3096
|
-
await new Promise((r) => setTimeout(r, holdMs));
|
|
3097
|
-
await send("Input.dispatchMouseEvent", { type: "mouseReleased", ...pos, ...btn });
|
|
3098
|
-
}
|
|
3099
|
-
});
|
|
3100
|
-
}
|
|
3101
3081
|
async function clickByTextViaPlaywright(opts) {
|
|
3102
3082
|
const page = await getRestoredPageForTarget(opts);
|
|
3103
3083
|
const timeout = resolveInteractionTimeoutMs(opts.timeoutMs);
|
|
@@ -4946,31 +4926,6 @@ var CrawlPage = class {
|
|
|
4946
4926
|
delayMs: opts?.delayMs
|
|
4947
4927
|
});
|
|
4948
4928
|
}
|
|
4949
|
-
/**
|
|
4950
|
-
* Press and hold at page coordinates using raw CDP events.
|
|
4951
|
-
*
|
|
4952
|
-
* Bypasses Playwright's automation layer by dispatching CDP
|
|
4953
|
-
* `Input.dispatchMouseEvent` directly — useful for anti-bot challenges
|
|
4954
|
-
* that detect automated clicks.
|
|
4955
|
-
*
|
|
4956
|
-
* @param x - X coordinate in CSS pixels
|
|
4957
|
-
* @param y - Y coordinate in CSS pixels
|
|
4958
|
-
* @param opts - Options (holdMs: hold duration, default 1000, max 30000)
|
|
4959
|
-
*
|
|
4960
|
-
* @example
|
|
4961
|
-
* ```ts
|
|
4962
|
-
* await page.pressAndHold(400, 300, { holdMs: 5000 });
|
|
4963
|
-
* ```
|
|
4964
|
-
*/
|
|
4965
|
-
async pressAndHold(x, y, opts) {
|
|
4966
|
-
return pressAndHoldViaCdp({
|
|
4967
|
-
cdpUrl: this.cdpUrl,
|
|
4968
|
-
targetId: this.targetId,
|
|
4969
|
-
x,
|
|
4970
|
-
y,
|
|
4971
|
-
holdMs: opts?.holdMs
|
|
4972
|
-
});
|
|
4973
|
-
}
|
|
4974
4929
|
/**
|
|
4975
4930
|
* Click an element by its visible text content (no snapshot/ref needed).
|
|
4976
4931
|
*
|