@opensteer/engine-playwright 0.8.4 → 0.8.6

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 CHANGED
@@ -1578,6 +1578,13 @@ async function waitForActionBoundary(input) {
1578
1578
  continue;
1579
1579
  }
1580
1580
  if (crossDocument) {
1581
+ if (!postLoadTrackerIsSettled(
1582
+ await input.readTrackerState(),
1583
+ DEFAULT_POST_LOAD_TRACKER_QUIET_WINDOW_MS
1584
+ )) {
1585
+ await delay(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
1586
+ continue;
1587
+ }
1581
1588
  return {
1582
1589
  trigger,
1583
1590
  crossDocument,
@@ -4950,6 +4957,39 @@ var PlaywrightBrowserCoreEngine = class _PlaywrightBrowserCoreEngine {
4950
4957
  throw normalizePlaywrightError(error, controller.pageRef);
4951
4958
  }
4952
4959
  }
4960
+ async evaluateFrame(input) {
4961
+ const frameState = this.requireFrame(input.frameRef);
4962
+ const controller = this.requirePage(frameState.pageRef);
4963
+ const startedAt = Date.now();
4964
+ const frame = this.requireLiveFrame(input.frameRef);
4965
+ try {
4966
+ const result = await withTimeout(
4967
+ frame.evaluate(
4968
+ ({ script, args }) => {
4969
+ const evaluated = (0, eval)(script);
4970
+ if (typeof evaluated === "function") {
4971
+ return evaluated(...args ?? []);
4972
+ }
4973
+ return evaluated;
4974
+ },
4975
+ {
4976
+ script: input.script,
4977
+ args: input.args ?? []
4978
+ }
4979
+ ),
4980
+ input.timeoutMs
4981
+ );
4982
+ return this.createStepResult(controller.sessionRef, controller.pageRef, startedAt, {
4983
+ frameRef: frameState.frameRef,
4984
+ documentRef: frameState.currentDocument.documentRef,
4985
+ documentEpoch: frameState.currentDocument.documentEpoch,
4986
+ events: this.drainQueuedEvents(controller.pageRef),
4987
+ data: result
4988
+ });
4989
+ } catch (error) {
4990
+ throw normalizePlaywrightError(error, controller.pageRef);
4991
+ }
4992
+ }
4953
4993
  async addInitScript(input) {
4954
4994
  if (!hasCapability(this.capabilities, "instrumentation.initScripts")) {
4955
4995
  throw unsupportedCapabilityError("instrumentation.initScripts");