omowright 0.3.6 → 0.3.7
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/TOOLS.md +3 -0
- package/dist/index.js +108 -45
- package/dist/redact-value.d.ts +16 -3
- package/package.json +1 -1
- package/presets/agent-events/SKILL.md +2 -0
- package/presets/captcha/SKILL.md +1 -0
- package/presets/chrome/SKILL.md +1 -0
- package/presets/cloak-bridge/SKILL.md +1 -0
- package/presets/network/SKILL.md +1 -0
- package/presets/visual-browse/SKILL.md +8 -6
- package/skills/omowright/references/1password.md +2 -0
- package/skills/omowright/references/browserskill.md +1 -0
- package/skills/omowright/references/eval-kernel.md +2 -0
- package/skills/omowright/references/frames-layers-human.md +1 -0
- package/skills/omowright/references/quickstart.md +4 -3
- package/skills/omowright/references/stealth.md +4 -0
package/TOOLS.md
CHANGED
|
@@ -414,6 +414,8 @@ readiness is content-probe based).
|
|
|
414
414
|
A policy is either an object or a function:
|
|
415
415
|
|
|
416
416
|
```js
|
|
417
|
+
const { connectPipe } = await import("omowright");
|
|
418
|
+
// given: browserPath, browserArgs, storageRoot
|
|
417
419
|
const browser = await connectPipe({ browserPath, browserArgs, storageRoot, dialogPolicy: { accept: false } }); // confirm() -> false, prompt() -> null
|
|
418
420
|
browser.setDialogPolicy({ accept: true, promptText: "agent@example.com" }); // prompt() -> the text
|
|
419
421
|
browser.setDialogPolicy((dialog) => {
|
|
@@ -441,6 +443,7 @@ browser.cdp.dialogPolicy; // read the current policy (client getter)
|
|
|
441
443
|
`page.waitForEvent('dialog')`) leaves the dialog to the policy:
|
|
442
444
|
|
|
443
445
|
```js
|
|
446
|
+
// given: page
|
|
444
447
|
page.on("dialog", (dialog) => (dialog.type() === "prompt" ? dialog.accept("agent@example.com") : dialog.dismiss()));
|
|
445
448
|
```
|
|
446
449
|
|
package/dist/index.js
CHANGED
|
@@ -24467,50 +24467,108 @@ function redactValue(error, value) {
|
|
|
24467
24467
|
const anyForm = `(?:${forms.join("|")})`;
|
|
24468
24468
|
const pattern = new RegExp(value.length >= REMOVED_ANYWHERE_FROM_LENGTH ? anyForm : `(?<![\\p{L}\\p{N}])${anyForm}(?![\\p{L}\\p{N}])`, "gu");
|
|
24469
24469
|
const scrub = (text) => text.replace(pattern, replacement);
|
|
24470
|
-
|
|
24471
|
-
|
|
24472
|
-
|
|
24473
|
-
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
}
|
|
24481
|
-
|
|
24470
|
+
return carries(error, scrub) ? scrubbed(error, scrub, replacement) : error;
|
|
24471
|
+
}
|
|
24472
|
+
function isOpaque(member) {
|
|
24473
|
+
return ArrayBuffer.isView(member) || member instanceof ArrayBuffer || member instanceof Date || member instanceof RegExp || member instanceof Promise || member instanceof WeakMap || member instanceof WeakSet;
|
|
24474
|
+
}
|
|
24475
|
+
function ownValue(holder, key) {
|
|
24476
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(holder, key);
|
|
24477
|
+
if (descriptor === undefined)
|
|
24478
|
+
return { readable: false };
|
|
24479
|
+
if ("value" in descriptor)
|
|
24480
|
+
return { readable: true, value: descriptor.value };
|
|
24481
|
+
try {
|
|
24482
|
+
return { readable: true, value: descriptor.get?.call(holder) };
|
|
24483
|
+
} catch {
|
|
24484
|
+
return { readable: false };
|
|
24485
|
+
}
|
|
24486
|
+
}
|
|
24487
|
+
function ownEntries(holder) {
|
|
24488
|
+
const entries = [];
|
|
24489
|
+
for (const key of Reflect.ownKeys(holder)) {
|
|
24490
|
+
if (Array.isArray(holder) && key === "length")
|
|
24491
|
+
continue;
|
|
24492
|
+
const own = ownValue(holder, key);
|
|
24493
|
+
if (own.readable)
|
|
24494
|
+
entries.push([key, own.value]);
|
|
24495
|
+
}
|
|
24496
|
+
return entries;
|
|
24497
|
+
}
|
|
24498
|
+
function carries(root, scrub) {
|
|
24482
24499
|
const seen = new Set;
|
|
24483
|
-
|
|
24484
|
-
if (member
|
|
24485
|
-
|
|
24500
|
+
const visit = (member) => {
|
|
24501
|
+
if (typeof member === "string")
|
|
24502
|
+
return scrub(member) !== member;
|
|
24503
|
+
if (typeof member === "number" || typeof member === "bigint")
|
|
24504
|
+
return scrub(String(member)) !== String(member);
|
|
24505
|
+
if (typeof member !== "object" || member === null || seen.has(member) || isOpaque(member))
|
|
24506
|
+
return false;
|
|
24507
|
+
seen.add(member);
|
|
24508
|
+
if (member instanceof Map && [...member].some(([key, entry]) => visit(key) || visit(entry)))
|
|
24509
|
+
return true;
|
|
24510
|
+
if (member instanceof Set && [...member].some((entry) => visit(entry)))
|
|
24511
|
+
return true;
|
|
24512
|
+
return ownEntries(member).some(([, entry]) => visit(entry));
|
|
24513
|
+
};
|
|
24514
|
+
return visit(root);
|
|
24515
|
+
}
|
|
24516
|
+
function rewritable(error) {
|
|
24517
|
+
if (Object.isFrozen(error))
|
|
24518
|
+
return false;
|
|
24519
|
+
return Reflect.ownKeys(error).every((key) => {
|
|
24520
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(error, key);
|
|
24521
|
+
return descriptor === undefined || descriptor.configurable === true || descriptor.writable === true;
|
|
24522
|
+
});
|
|
24523
|
+
}
|
|
24524
|
+
function emptyLike(member) {
|
|
24525
|
+
if (Array.isArray(member))
|
|
24526
|
+
return [];
|
|
24527
|
+
if (member instanceof Map)
|
|
24528
|
+
return new Map;
|
|
24529
|
+
if (member instanceof Set)
|
|
24530
|
+
return new Set;
|
|
24531
|
+
return Object.create(Reflect.getPrototypeOf(member));
|
|
24532
|
+
}
|
|
24533
|
+
function scrubbed(root, scrub, replacement) {
|
|
24534
|
+
const results = new Map;
|
|
24535
|
+
const clean = (member) => {
|
|
24536
|
+
if (typeof member === "string")
|
|
24537
|
+
return scrub(member);
|
|
24538
|
+
if (typeof member === "number" || typeof member === "bigint") {
|
|
24539
|
+
return scrub(String(member)) === String(member) ? member : replacement;
|
|
24540
|
+
}
|
|
24541
|
+
if (typeof member !== "object" || member === null || isOpaque(member))
|
|
24486
24542
|
return member;
|
|
24487
|
-
|
|
24488
|
-
if (
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
if (
|
|
24504
|
-
continue;
|
|
24505
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(link, key);
|
|
24506
|
-
if (descriptor === undefined || !("value" in descriptor))
|
|
24543
|
+
const known = results.get(member);
|
|
24544
|
+
if (known !== undefined)
|
|
24545
|
+
return known;
|
|
24546
|
+
const inPlace = member instanceof Error && rewritable(member);
|
|
24547
|
+
if (!inPlace && !carries(member, scrub))
|
|
24548
|
+
return member;
|
|
24549
|
+
const target = inPlace ? member : emptyLike(member);
|
|
24550
|
+
results.set(member, target);
|
|
24551
|
+
if (member instanceof Map && target instanceof Map)
|
|
24552
|
+
for (const [key, entry] of member)
|
|
24553
|
+
target.set(clean(key), clean(entry));
|
|
24554
|
+
if (member instanceof Set && target instanceof Set)
|
|
24555
|
+
for (const entry of member)
|
|
24556
|
+
target.add(clean(entry));
|
|
24557
|
+
for (const [key, entry] of ownEntries(member)) {
|
|
24558
|
+
const next = clean(entry);
|
|
24559
|
+
if (inPlace && Object.is(next, entry))
|
|
24507
24560
|
continue;
|
|
24508
|
-
const
|
|
24509
|
-
if (
|
|
24510
|
-
Reflect.defineProperty(
|
|
24561
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(member, key);
|
|
24562
|
+
if (inPlace && descriptor !== undefined && "value" in descriptor)
|
|
24563
|
+
Reflect.defineProperty(target, key, { value: next });
|
|
24564
|
+
else {
|
|
24565
|
+
const enumerable = descriptor?.enumerable === true;
|
|
24566
|
+
Reflect.defineProperty(target, key, { value: next, writable: true, enumerable, configurable: true });
|
|
24567
|
+
}
|
|
24511
24568
|
}
|
|
24512
|
-
|
|
24513
|
-
|
|
24569
|
+
return target;
|
|
24570
|
+
};
|
|
24571
|
+
return clean(root);
|
|
24514
24572
|
}
|
|
24515
24573
|
|
|
24516
24574
|
// src/core.ts
|
|
@@ -31455,6 +31513,7 @@ function ownProcessStartTime() {
|
|
|
31455
31513
|
var TERM_GRACE_MS = 5000;
|
|
31456
31514
|
var PID_FILE_NAME = "omowright-browser.pid";
|
|
31457
31515
|
var REAP_POLL_MS = 50;
|
|
31516
|
+
var KILL_SETTLE_MS = 2000;
|
|
31458
31517
|
var browserSpawnDetached = process.platform !== "win32";
|
|
31459
31518
|
function profileDirFromArgs(browserArgs) {
|
|
31460
31519
|
for (const [index, argument] of browserArgs.entries()) {
|
|
@@ -31558,16 +31617,20 @@ async function reapOrphanedBrowser(profileDir) {
|
|
|
31558
31617
|
try {
|
|
31559
31618
|
process.kill(pid, "SIGTERM");
|
|
31560
31619
|
} catch {}
|
|
31561
|
-
|
|
31562
|
-
while (isPidAlive(pid) && Date.now() < deadline)
|
|
31563
|
-
await sleep2(REAP_POLL_MS);
|
|
31564
|
-
if (isPidAlive(pid)) {
|
|
31620
|
+
if (!await processGone(pid, TERM_GRACE_MS)) {
|
|
31565
31621
|
try {
|
|
31566
31622
|
process.kill(pid, "SIGKILL");
|
|
31567
31623
|
} catch {}
|
|
31624
|
+
await processGone(pid, KILL_SETTLE_MS);
|
|
31568
31625
|
}
|
|
31569
31626
|
rmSync(pidFilePath(profileDir), { force: true });
|
|
31570
31627
|
}
|
|
31628
|
+
async function processGone(pid, withinMs) {
|
|
31629
|
+
const deadline = Date.now() + withinMs;
|
|
31630
|
+
while (isPidAlive(pid) && Date.now() < deadline)
|
|
31631
|
+
await sleep2(REAP_POLL_MS);
|
|
31632
|
+
return !isPidAlive(pid);
|
|
31633
|
+
}
|
|
31571
31634
|
|
|
31572
31635
|
// src/nul-frames.ts
|
|
31573
31636
|
class NulFrameReader {
|
|
@@ -35736,7 +35799,7 @@ async function snapshotWithFrames(page, opts = {}) {
|
|
|
35736
35799
|
// package.json
|
|
35737
35800
|
var package_default = {
|
|
35738
35801
|
name: "omowright",
|
|
35739
|
-
version: "0.3.
|
|
35802
|
+
version: "0.3.7",
|
|
35740
35803
|
description: "OmOWright browser automation for standard Chromium CDP endpoints.",
|
|
35741
35804
|
keywords: [
|
|
35742
35805
|
"accessibility-snapshot",
|
package/dist/redact-value.d.ts
CHANGED
|
@@ -2,11 +2,24 @@
|
|
|
2
2
|
* Strips a value being entered (fill/type) out of the error its failure raised, so a secret typed
|
|
3
3
|
* into a form never reaches an agent transcript (#335). The layers below (a CDP transport, the
|
|
4
4
|
* BrowserSkill daemon) may quote the command they refused, raw or JSON-escaped, anywhere in what they
|
|
5
|
-
* throw
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* throw, so the whole graph of the error is read (#362, #366):
|
|
6
|
+
*
|
|
7
|
+
* - An error that does not carry the value is returned untouched.
|
|
8
|
+
* - Every `Error` in the graph is rewritten in place and keeps its identity and class, wherever it sits:
|
|
9
|
+
* a cause, a member of an `AggregateError`, a field of a payload.
|
|
10
|
+
* - Anything else that carries the value (a payload object, an array, a `Map`, a `Set`) is replaced by a
|
|
11
|
+
* scrubbed copy and never mutated: it may be an object the caller still uses, such as the command's
|
|
12
|
+
* own parameters. A part that does not carry the value stays the same object.
|
|
13
|
+
* - An `Error` that cannot be rewritten (frozen, or holding a field that is neither writable nor
|
|
14
|
+
* configurable) is replaced by a scrubbed copy of the same class.
|
|
15
|
+
*
|
|
16
|
+
* Reached: own properties (an accessor is read once and, when it carries the value, replaced by the
|
|
17
|
+
* scrubbed result), array elements, `Map` and `Set` entries, numbers whose digits contain the value.
|
|
18
|
+
* Not reached: property names, private fields, what only a prototype accessor computes, binary buffers.
|
|
19
|
+
*
|
|
8
20
|
* A value of four characters or more is removed even where it touches a letter or a digit
|
|
9
21
|
* (`field7<value>`); a shorter one is removed only as a whole token, because taking one or two
|
|
10
22
|
* letters out of every word would leave the message unreadable (fill("a") must keep "locator").
|
|
23
|
+
* That is a readability rule: a short value next to a letter or digit stays readable.
|
|
11
24
|
*/
|
|
12
25
|
export declare function redactValue(error: unknown, value: string): unknown;
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ One events capability per connection; await `ready` before trusting baseline
|
|
|
12
12
|
discovery or download configuration:
|
|
13
13
|
|
|
14
14
|
```js
|
|
15
|
+
// given: connection (what connectPipe or connect returned)
|
|
15
16
|
import { createEvents, createAgentTabs } from "omowright";
|
|
16
17
|
|
|
17
18
|
const events = createEvents(connection, {
|
|
@@ -28,6 +29,7 @@ Install the listener or `waitForEvent()` before the action that produces the
|
|
|
28
29
|
event. Waits are bounded; predicates may be async:
|
|
29
30
|
|
|
30
31
|
```js
|
|
32
|
+
// given: mainTargetId, mainPage
|
|
31
33
|
const opened = events.waitForEvent("popupOpened", {
|
|
32
34
|
timeout: 30_000,
|
|
33
35
|
predicate: (tab) => tab.openerTargetId === mainTargetId,
|
package/presets/captcha/SKILL.md
CHANGED
|
@@ -15,6 +15,7 @@ before measuring coordinates (`Emulation.setDeviceMetricsOverride` and
|
|
|
15
15
|
`refreshViewportSize`), and measure again after scrolling, resizing, or reflow.
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
|
+
// given: page
|
|
18
19
|
import { createCaptcha } from "omowright";
|
|
19
20
|
const captcha = createCaptcha(page);
|
|
20
21
|
```
|
package/presets/chrome/SKILL.md
CHANGED
|
@@ -9,6 +9,7 @@ description: Read this when you need Chrome MV3-shaped APIs — bookmarks, tabs,
|
|
|
9
9
|
CDP and the browser's own profile files — no extension required.
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
+
// given: connection (what connectPipe or connect returned)
|
|
12
13
|
import { createChromeApi } from "omowright";
|
|
13
14
|
|
|
14
15
|
const chrome = createChromeApi(connection, {
|
|
@@ -12,6 +12,7 @@ host manifest needs an absolute executable path and exactly one
|
|
|
12
12
|
GO TO STDERR.**
|
|
13
13
|
|
|
14
14
|
```js
|
|
15
|
+
// given: extensionId, stdin, stdout, connection, profilePath
|
|
15
16
|
import { createBridgeClient, createChromeApi } from "omowright";
|
|
16
17
|
const bridge = createBridgeClient({ extensionId, stdin, stdout });
|
|
17
18
|
const chrome = createChromeApi(connection, { profilePath, bridge });
|
package/presets/network/SKILL.md
CHANGED
|
@@ -20,6 +20,7 @@ arrived as JSON one request earlier. That JSON is complete, typed, and free of
|
|
|
20
20
|
truncated labels. Snapshot to find and click; snoop to read.
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
|
+
// given: page
|
|
23
24
|
const snoop = createNetworkSnoop(page, { match: { url: /\/api\//, mimeType: "json" } }); // strings match as substrings
|
|
24
25
|
await page.goto("https://example.com/search?q=widgets");
|
|
25
26
|
const results = snoop.popJson(); // parsed bodies, buffer drained
|
|
@@ -36,6 +36,7 @@ disagree, every coordinate is wrong by the same constant offset and retrying
|
|
|
36
36
|
repeats the miss. Pin both to one box:
|
|
37
37
|
|
|
38
38
|
```js
|
|
39
|
+
// given: page
|
|
39
40
|
const { repinViewport, DEFAULT_AGENT_VIEWPORT } = await import("omowright");
|
|
40
41
|
const size = await repinViewport(page, DEFAULT_AGENT_VIEWPORT); // -> { width: 1440, height: 900 }
|
|
41
42
|
```
|
|
@@ -52,14 +53,15 @@ coordinates you computed.
|
|
|
52
53
|
```js
|
|
53
54
|
import { createCua } from "omowright";
|
|
54
55
|
|
|
56
|
+
// given: x, y, text
|
|
55
57
|
const cua = createCua(page);
|
|
56
|
-
await cua.click({ x, y
|
|
57
|
-
await cua.doubleClick({ x, y
|
|
58
|
-
await cua.drag({ path: [{ x, y },
|
|
59
|
-
await cua.move({ x, y
|
|
60
|
-
await cua.scroll({ x, y, scrollX, scrollY
|
|
58
|
+
await cua.click({ x, y }); // options: button, keypress (modifiers held during the click)
|
|
59
|
+
await cua.doubleClick({ x, y }); // option: keypress
|
|
60
|
+
await cua.drag({ path: [{ x, y }, { x: x + 80, y }] }); // mousedown at the first point, move through the path, mouseup; option: keys
|
|
61
|
+
await cua.move({ x, y }); // option: keys
|
|
62
|
+
await cua.scroll({ x, y, scrollX: 0, scrollY: 400 }); // option: keypress
|
|
61
63
|
await cua.type({ text });
|
|
62
|
-
await cua.keypress({ keys: ["ControlOrMeta", "a"] });
|
|
64
|
+
await cua.keypress({ keys: ["ControlOrMeta", "a"] }); // ControlOrMeta = Meta on macOS, Control elsewhere
|
|
63
65
|
const base64Png = await cua.getVisibleScreenshot();
|
|
64
66
|
```
|
|
65
67
|
|
|
@@ -73,6 +73,7 @@ without updating the title, so the title can read "sign in" while the vault is
|
|
|
73
73
|
open.
|
|
74
74
|
|
|
75
75
|
```js
|
|
76
|
+
// given: page
|
|
76
77
|
const url = await page.evaluate(() => location.href);
|
|
77
78
|
if (!url.includes("/app#/")) throw new Error("1password: not signed in");
|
|
78
79
|
```
|
|
@@ -94,6 +95,7 @@ click and type over `locator.fill()` on a tab another automation also drives:
|
|
|
94
95
|
`fill()` installs an init script that can time out on a busy tab.
|
|
95
96
|
|
|
96
97
|
```js
|
|
98
|
+
// given: searchRef, query (the search box's ref from the snapshot, and the item to look for)
|
|
97
99
|
const { compactSnapshot } = await import("omowright");
|
|
98
100
|
await page.locator(searchRef).click();
|
|
99
101
|
await page.keyboard.press("Meta+a");
|
|
@@ -163,6 +163,7 @@ bot detection; for WAF-heavy targets use the owned engine with CloakBrowser
|
|
|
163
163
|
## Onboarding: everything except one click
|
|
164
164
|
|
|
165
165
|
```js
|
|
166
|
+
// given: knownBrowserOrUndefined (a browser id from an earlier report, or undefined)
|
|
166
167
|
const { bskDoctor, bskOnboard } = await import("omowright");
|
|
167
168
|
const report = await bskDoctor(); // {cli, daemon, browsers, primary, identification, browsersConnected, ready, nextStep}
|
|
168
169
|
if (!report.ready) {
|
|
@@ -25,6 +25,7 @@ rejects every call, so probe before reuse. Two patterns hold up everywhere:
|
|
|
25
25
|
the setup cell below):
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
|
+
// given: shell, profile, omwTools (all three from the setup cell below)
|
|
28
29
|
await tool.monitor({
|
|
29
30
|
description: "omowright browser",
|
|
30
31
|
command: `${shell} --headless --no-first-run --remote-debugging-port=9333 --user-data-dir=${profile} about:blank`,
|
|
@@ -119,6 +120,7 @@ transport has no ports to collide on. Every lane connects, acts, and closes
|
|
|
119
120
|
inside the cell, so the reaping rule never bites.
|
|
120
121
|
|
|
121
122
|
```js
|
|
123
|
+
// given: urls
|
|
122
124
|
const results = await parallel(
|
|
123
125
|
[1, 2, 3].map((i) => async () => {
|
|
124
126
|
const prof = fs.mkdtempSync(path.join(os.tmpdir(), `omw-lane${i}-`));
|
|
@@ -49,6 +49,7 @@ embedder instead of the frame. Take a fresh snapshot and click the ref again;
|
|
|
49
49
|
the second attempt lands.
|
|
50
50
|
|
|
51
51
|
```js
|
|
52
|
+
// given: page
|
|
52
53
|
const snap = await snapshotWithFrames(page, { interactive: true });
|
|
53
54
|
if (snap.missingFrames) console.log("unreachable frames:", snap.missingFrames);
|
|
54
55
|
await page.locator("f1e3").fill("4242 4242 4242 4242");
|
|
@@ -8,7 +8,7 @@ Bun >= 1.4 recommended (`bun test` runs the suite as-is); Node >= 22 supported
|
|
|
8
8
|
## Two transports
|
|
9
9
|
|
|
10
10
|
```js
|
|
11
|
-
const { connect, connectPipe } = await import("omowright");
|
|
11
|
+
const { connect, connectPipe, compactSnapshot } = await import("omowright");
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
- `connectPipe({ browserPath, browserArgs, storageRoot })` — launches a browser
|
|
@@ -55,13 +55,14 @@ slashes or `String.raw`: backslashes in a plain string literal are escapes
|
|
|
55
55
|
## Page essentials
|
|
56
56
|
|
|
57
57
|
```js
|
|
58
|
+
// given: browser, url
|
|
58
59
|
const page = await browser.newTab(url); // waits for interactivity
|
|
59
60
|
await page.goto(url); // content-probe readiness
|
|
60
61
|
await page.goto(url, { waitUntil: "commit" }); // escape hatch for tiny pages
|
|
61
62
|
await page.title(); page.url();
|
|
62
63
|
await page.evaluate("document.readyState");
|
|
63
|
-
await page.screenshot({ path, fullPage
|
|
64
|
-
await page.pdf({ path, format
|
|
64
|
+
await page.screenshot({ path: "shot.png", fullPage: true }); // also clip, type, quality
|
|
65
|
+
await page.pdf({ path: "page.pdf", format: "A4" }); // also margin
|
|
65
66
|
await page.locator("e1").click(); // ref or CSS
|
|
66
67
|
await page.locator("input[name=q]").fill("text");
|
|
67
68
|
await page.keyboard.press("Enter"); await page.mouse.wheel(0, 400);
|
|
@@ -44,6 +44,7 @@ Name-less launches keep the pipe and expose no port at all, so use a name only
|
|
|
44
44
|
on a machine you trust and only when the instance is meant to be shared.
|
|
45
45
|
|
|
46
46
|
```js
|
|
47
|
+
// given: browserPath, browserArgs, profileDir, registryRoot (each optional)
|
|
47
48
|
const { connectNamed, listInstances } = await import("omowright");
|
|
48
49
|
const browser = await connectNamed("cloak-main", {
|
|
49
50
|
browserPath, // required only when a launch is needed (connectCloakProfile resolves it)
|
|
@@ -75,6 +76,7 @@ curl -s -m 2 http://127.0.0.1:9242/json/version # Browser info -> an instance
|
|
|
75
76
|
```
|
|
76
77
|
|
|
77
78
|
```js
|
|
79
|
+
const { connect } = await import("omowright");
|
|
78
80
|
const browser = await connect("http://127.0.0.1:9242");
|
|
79
81
|
const page = await browser.newTab("https://target.com");
|
|
80
82
|
// ... work ...
|
|
@@ -117,6 +119,8 @@ WAF trust builds with profile age. To import cookies from a real browser profile
|
|
|
117
119
|
extract them to JSON and inject with the package helper:
|
|
118
120
|
|
|
119
121
|
```js
|
|
122
|
+
import fs from "node:fs";
|
|
123
|
+
// given: cookieFile, url
|
|
120
124
|
import { injectCookies } from "omowright";
|
|
121
125
|
const cookies = JSON.parse(await fs.promises.readFile(cookieFile, "utf8"));
|
|
122
126
|
await injectCookies(page, cookies); // sanitize + Network.setCookies
|