fix(browser): persist role refs per targetId

This commit is contained in:
Peter Steinberger
2026-01-15 09:56:19 +00:00
parent 84e9401d53
commit d5d33d4848
10 changed files with 119 additions and 4 deletions

View File

@@ -4,7 +4,12 @@ import path from "node:path";
import type { Page } from "playwright-core";
import { ensurePageState, getPageForTargetId, refLocator } from "./pw-session.js";
import {
ensurePageState,
getPageForTargetId,
refLocator,
restoreRoleRefsForTarget,
} from "./pw-session.js";
import {
bumpDialogArmId,
bumpDownloadArmId,
@@ -189,6 +194,7 @@ export async function downloadViaPlaywright(opts: {
}> {
const page = await getPageForTargetId(opts);
const state = ensurePageState(page);
restoreRoleRefsForTarget({ cdpUrl: opts.cdpUrl, targetId: opts.targetId, page });
const timeout = normalizeTimeoutMs(opts.timeoutMs, 120_000);
const ref = requireRef(opts.ref);