playwright-core 1.57.0-alpha-2025-10-21 → 1.57.0-alpha-2025-10-23

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.
@@ -89,10 +89,8 @@ class FrameSelectors {
89
89
  const match = body.match(/^f(\d+)e\d+$/);
90
90
  if (!match)
91
91
  return frame;
92
- const frameIndex = +match[1];
93
- const page = this.frame._page;
94
- const frameId = page.lastSnapshotFrameIds[frameIndex - 1];
95
- const jumptToFrame = frameId ? page.frameManager.frame(frameId) : null;
92
+ const frameSeq = +match[1];
93
+ const jumptToFrame = this.frame._page.frameManager.frames().find((frame2) => frame2.seq === frameSeq);
96
94
  if (!jumptToFrame)
97
95
  throw new import_selectorParser.InvalidSelectorError(`Invalid frame in aria-ref selector "${selector}"`);
98
96
  return jumptToFrame;
@@ -65,9 +65,13 @@ class FrameManager {
65
65
  this._consoleMessageTags = /* @__PURE__ */ new Map();
66
66
  this._signalBarriers = /* @__PURE__ */ new Set();
67
67
  this._webSockets = /* @__PURE__ */ new Map();
68
+ this._nextFrameSeq = 0;
68
69
  this._page = page;
69
70
  this._mainFrame = void 0;
70
71
  }
72
+ nextFrameSeq() {
73
+ return this._nextFrameSeq++;
74
+ }
71
75
  createDummyMainFrameIfNeeded() {
72
76
  if (!this._mainFrame)
73
77
  this.frameAttached(kDummyFrameId, null);
@@ -361,6 +365,7 @@ class Frame extends import_instrumentation.SdkObject {
361
365
  this._raceAgainstEvaluationStallingEventsPromises = /* @__PURE__ */ new Set();
362
366
  this._redirectedNavigations = /* @__PURE__ */ new Map();
363
367
  this.attribution.frame = this;
368
+ this.seq = page.frameManager.nextFrameSeq();
364
369
  this._id = id;
365
370
  this._page = page;
366
371
  this._parentFrame = parentFrame;
@@ -78,7 +78,6 @@ class Page extends import_instrumentation.SdkObject {
78
78
  // Aiming at 25 fps by default - each frame is 40ms, but we give some slack with 35ms.
79
79
  // When throttling for tracing, 200ms between frames, except for 10 frames around the action.
80
80
  this._frameThrottler = new FrameThrottler(10, 35, 200);
81
- this.lastSnapshotFrameIds = [];
82
81
  this.attribution.page = this;
83
82
  this.delegate = delegate;
84
83
  this.browserContext = browserContext;
@@ -667,8 +666,7 @@ class Page extends import_instrumentation.SdkObject {
667
666
  })));
668
667
  }
669
668
  async snapshotForAI(progress, options) {
670
- this.lastSnapshotFrameIds = [];
671
- const snapshot = await snapshotFrameForAI(progress, this.mainFrame(), 0, this.lastSnapshotFrameIds, options);
669
+ const snapshot = await snapshotFrameForAI(progress, this.mainFrame(), options);
672
670
  return snapshot.join("\n");
673
671
  }
674
672
  }
@@ -809,7 +807,7 @@ class FrameThrottler {
809
807
  }
810
808
  }
811
809
  }
812
- async function snapshotFrameForAI(progress, frame, frameOrdinal, frameIds, options) {
810
+ async function snapshotFrameForAI(progress, frame, options) {
813
811
  const snapshot = await frame.retryWithProgressAndTimeouts(progress, [1e3, 2e3, 4e3, 8e3], async (continuePolling) => {
814
812
  try {
815
813
  const context = await progress.race(frame._utilityContext());
@@ -819,7 +817,7 @@ async function snapshotFrameForAI(progress, frame, frameOrdinal, frameIds, optio
819
817
  if (!node)
820
818
  return true;
821
819
  return injected.ariaSnapshot(node, { mode: "ai", ...options2 });
822
- }, { refPrefix: frameOrdinal ? "f" + frameOrdinal : "", incremental: options.mode === "incremental", track: options.track }));
820
+ }, { refPrefix: frame.seq ? "f" + frame.seq : "", incremental: options.mode === "incremental", track: options.track }));
823
821
  if (snapshotOrRetry === true)
824
822
  return continuePolling;
825
823
  return snapshotOrRetry;
@@ -846,10 +844,8 @@ async function snapshotFrameForAI(progress, frame, frameOrdinal, frameIds, optio
846
844
  result.push(line);
847
845
  continue;
848
846
  }
849
- const frameOrdinal2 = frameIds.length + 1;
850
- frameIds.push(child.frame._id);
851
847
  try {
852
- const childSnapshot = await snapshotFrameForAI(progress, child.frame, frameOrdinal2, frameIds, options);
848
+ const childSnapshot = await snapshotFrameForAI(progress, child.frame, options);
853
849
  result.push(line + ":", ...childSnapshot.map((l) => leadingSpace + " " + l));
854
850
  } catch {
855
851
  result.push(line);
@@ -39,7 +39,8 @@ __export(utilsBundle_exports, {
39
39
  wsReceiver: () => wsReceiver,
40
40
  wsSender: () => wsSender,
41
41
  wsServer: () => wsServer,
42
- yaml: () => yaml
42
+ yaml: () => yaml,
43
+ zod: () => zod
43
44
  });
44
45
  module.exports = __toCommonJS(utilsBundle_exports);
45
46
  const colors = require("./utilsBundleImpl").colors;
@@ -58,11 +59,12 @@ const program = require("./utilsBundleImpl").program;
58
59
  const ProgramOption = require("./utilsBundleImpl").ProgramOption;
59
60
  const progress = require("./utilsBundleImpl").progress;
60
61
  const SocksProxyAgent = require("./utilsBundleImpl").SocksProxyAgent;
61
- const yaml = require("./utilsBundleImpl").yaml;
62
62
  const ws = require("./utilsBundleImpl").ws;
63
63
  const wsServer = require("./utilsBundleImpl").wsServer;
64
64
  const wsReceiver = require("./utilsBundleImpl").wsReceiver;
65
65
  const wsSender = require("./utilsBundleImpl").wsSender;
66
+ const yaml = require("./utilsBundleImpl").yaml;
67
+ const zod = require("./utilsBundleImpl").zod;
66
68
  function ms(ms2) {
67
69
  if (!isFinite(ms2))
68
70
  return "-";
@@ -105,5 +107,6 @@ function ms(ms2) {
105
107
  wsReceiver,
106
108
  wsSender,
107
109
  wsServer,
108
- yaml
110
+ yaml,
111
+ zod
109
112
  });