patchright-core 1.52.4 → 1.52.5
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/lib/client/frame.js +3 -3
- package/lib/client/locator.js +2 -2
- package/lib/protocol/validator.js +2 -1
- package/lib/server/chromium/crNetworkManager.js +2 -2
- package/lib/server/chromium/crPage.js +0 -1
- package/lib/server/dispatchers/frameDispatcher.js +1 -1
- package/lib/server/frameSelectors.js +2 -2
- package/lib/server/frames.js +63 -31
- package/lib/server/javascript.js +1 -1
- package/lib/server/page.js +1 -1
- package/package.json +1 -1
- package/types/types.d.ts +20 -20
package/lib/client/frame.js
CHANGED
|
@@ -192,9 +192,9 @@ class Frame extends import_channelOwner.ChannelOwner {
|
|
|
192
192
|
const result = await this._channel.evalOnSelector({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
|
|
193
193
|
return (0, import_jsHandle.parseResult)(result.value);
|
|
194
194
|
}
|
|
195
|
-
async $$eval(selector, pageFunction, arg) {
|
|
196
|
-
(0, import_jsHandle.assertMaxArguments)(arguments.length,
|
|
197
|
-
const result = await this._channel.evalOnSelectorAll({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg) });
|
|
195
|
+
async $$eval(selector, pageFunction, arg, isolatedContext = true) {
|
|
196
|
+
(0, import_jsHandle.assertMaxArguments)(arguments.length, 4);
|
|
197
|
+
const result = await this._channel.evalOnSelectorAll({ selector, expression: String(pageFunction), isFunction: typeof pageFunction === "function", arg: (0, import_jsHandle.serializeArgument)(arg), isolatedContext });
|
|
198
198
|
return (0, import_jsHandle.parseResult)(result.value);
|
|
199
199
|
}
|
|
200
200
|
async $$(selector) {
|
package/lib/client/locator.js
CHANGED
|
@@ -112,8 +112,8 @@ class Locator {
|
|
|
112
112
|
options?.timeout
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
async evaluateAll(pageFunction, arg) {
|
|
116
|
-
return await this._frame.$$eval(this._selector, pageFunction, arg);
|
|
115
|
+
async evaluateAll(pageFunction, arg, isolatedContext = true) {
|
|
116
|
+
return await this._frame.$$eval(this._selector, pageFunction, arg, isolatedContext);
|
|
117
117
|
}
|
|
118
118
|
async evaluateHandle(pageFunction, arg, options, isolatedContext = true) {
|
|
119
119
|
return await this._withElement(
|
|
@@ -1464,7 +1464,8 @@ import_validatorPrimitives.scheme.FrameEvalOnSelectorAllParams = (0, import_vali
|
|
|
1464
1464
|
selector: import_validatorPrimitives.tString,
|
|
1465
1465
|
expression: import_validatorPrimitives.tString,
|
|
1466
1466
|
isFunction: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean),
|
|
1467
|
-
arg: (0, import_validatorPrimitives.tType)("SerializedArgument")
|
|
1467
|
+
arg: (0, import_validatorPrimitives.tType)("SerializedArgument"),
|
|
1468
|
+
isolatedContext: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean)
|
|
1468
1469
|
});
|
|
1469
1470
|
import_validatorPrimitives.scheme.FrameEvalOnSelectorAllResult = (0, import_validatorPrimitives.tObject)({
|
|
1470
1471
|
value: (0, import_validatorPrimitives.tType)("SerializedValue")
|
|
@@ -518,11 +518,11 @@ class RouteImpl {
|
|
|
518
518
|
if (overrides.url && (overrides.url === "http://patchright-init-script-inject.internal/" || overrides.url === "https://patchright-init-script-inject.internal/")) {
|
|
519
519
|
await catchDisallowedErrors(async () => {
|
|
520
520
|
this._sessionManager._alreadyTrackedNetworkIds.add(this._networkId);
|
|
521
|
-
this._session.
|
|
521
|
+
this._session._sendMayFail("Fetch.continueRequest", { requestId: this._interceptionId, interceptResponse: true });
|
|
522
522
|
});
|
|
523
523
|
} else {
|
|
524
524
|
await catchDisallowedErrors(async () => {
|
|
525
|
-
await this._session.
|
|
525
|
+
await this._session._sendMayFail("Fetch.continueRequest", this._alreadyContinuedParams);
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
528
|
}
|
|
@@ -495,7 +495,6 @@ class FrameSession {
|
|
|
495
495
|
}
|
|
496
496
|
async _navigate(frame, url, referrer) {
|
|
497
497
|
const response = await this._client.send("Page.navigate", { url, referrer, frameId: frame._id, referrerPolicy: "unsafeUrl" });
|
|
498
|
-
this._client._sendMayFail("Page.waitForDebugger");
|
|
499
498
|
if (response.errorText)
|
|
500
499
|
throw new frames.NavigationAbortedError(response.loaderId, `${response.errorText} at ${url}`);
|
|
501
500
|
return { newDocumentId: response.loaderId };
|
|
@@ -94,7 +94,7 @@ class FrameDispatcher extends import_dispatcher.Dispatcher {
|
|
|
94
94
|
return { value: (0, import_jsHandleDispatcher.serializeResult)(await this._frame.evalOnSelector(params.selector, !!params.strict, params.expression, params.isFunction, (0, import_jsHandleDispatcher.parseArgument)(params.arg))) };
|
|
95
95
|
}
|
|
96
96
|
async evalOnSelectorAll(params, metadata) {
|
|
97
|
-
return { value: (0, import_jsHandleDispatcher.serializeResult)(await this._frame.evalOnSelectorAll(params.selector, params.expression, params.isFunction, (0, import_jsHandleDispatcher.parseArgument)(params.arg))) };
|
|
97
|
+
return { value: (0, import_jsHandleDispatcher.serializeResult)(await this._frame.evalOnSelectorAll(params.selector, params.expression, params.isFunction, (0, import_jsHandleDispatcher.parseArgument)(params.arg), null, params.isolatedContext)) };
|
|
98
98
|
}
|
|
99
99
|
async querySelector(params, metadata) {
|
|
100
100
|
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.fromNullable(this, await this._frame.querySelector(params.selector, params)) };
|
|
@@ -46,8 +46,8 @@ class FrameSelectors {
|
|
|
46
46
|
}
|
|
47
47
|
return adoptIfNeeded(elementHandle, await resolved.frame._mainContext());
|
|
48
48
|
}
|
|
49
|
-
async queryArrayInMainWorld(selector, scope) {
|
|
50
|
-
const resolved = await this.resolveInjectedForSelector(selector, { mainWorld:
|
|
49
|
+
async queryArrayInMainWorld(selector, scope, isolatedContext) {
|
|
50
|
+
const resolved = await this.resolveInjectedForSelector(selector, { mainWorld: !isolatedContext }, scope);
|
|
51
51
|
if (!resolved)
|
|
52
52
|
throw new Error(`Failed to find frame for selector "${selector}"`);
|
|
53
53
|
return await resolved.injected.evaluateHandle((injected, { info, scope: scope2 }) => {
|
package/lib/server/frames.js
CHANGED
|
@@ -612,6 +612,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
612
612
|
return this._page._delegate.getFrameElement(this);
|
|
613
613
|
}
|
|
614
614
|
async _context(world) {
|
|
615
|
+
if (this.isDetached()) throw new Error("Frame was detached");
|
|
615
616
|
try {
|
|
616
617
|
var client = this._page._delegate._sessionForFrame(this)._client;
|
|
617
618
|
} catch (e) {
|
|
@@ -767,16 +768,21 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
767
768
|
async evalOnSelector(selector, strict, expression, isFunction, arg, scope) {
|
|
768
769
|
const handle = await this.selectors.query(selector, { strict }, scope);
|
|
769
770
|
if (!handle)
|
|
770
|
-
throw new Error(
|
|
771
|
-
const result = await handle.evaluateExpression(expression, { isFunction }, arg);
|
|
771
|
+
throw new Error("Failed to find element matching selector " + selector);
|
|
772
|
+
const result = await handle.evaluateExpression(expression, { isFunction }, arg, true);
|
|
772
773
|
handle.dispose();
|
|
773
774
|
return result;
|
|
774
775
|
}
|
|
775
|
-
async evalOnSelectorAll(selector, expression, isFunction, arg, scope) {
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
776
|
+
async evalOnSelectorAll(selector, expression, isFunction, arg, scope, isolatedContext) {
|
|
777
|
+
try {
|
|
778
|
+
const arrayHandle = await this.selectors.queryArrayInMainWorld(selector, scope, isolatedContext);
|
|
779
|
+
const result = await arrayHandle.evaluateExpression(expression, { isFunction }, arg, isolatedContext);
|
|
780
|
+
arrayHandle.dispose();
|
|
781
|
+
return result;
|
|
782
|
+
} catch (e) {
|
|
783
|
+
if ("JSHandles can be evaluated only in the context they were created!" === e.message) return await this.evalOnSelectorAll(selector, expression, isFunction, arg, scope, isolatedContext);
|
|
784
|
+
throw e;
|
|
785
|
+
}
|
|
780
786
|
}
|
|
781
787
|
async maskSelectors(selectors, color) {
|
|
782
788
|
const context = await this._utilityContext();
|
|
@@ -789,14 +795,15 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
789
795
|
return this.selectors.queryAll(selector);
|
|
790
796
|
}
|
|
791
797
|
async queryCount(selector) {
|
|
792
|
-
const
|
|
798
|
+
const customMetadata = {
|
|
793
799
|
"internal": false,
|
|
794
|
-
"log": []
|
|
800
|
+
"log": [],
|
|
801
|
+
"method": "queryCount"
|
|
795
802
|
};
|
|
796
|
-
const controller = new import_progress.ProgressController(
|
|
803
|
+
const controller = new import_progress.ProgressController(customMetadata, this);
|
|
797
804
|
const resultPromise = await controller.run(async (progress) => {
|
|
798
805
|
progress.log("waiting for " + this._asLocator(selector));
|
|
799
|
-
const promise = await this._retryWithProgressIfNotConnected(progress, selector,
|
|
806
|
+
const promise = await this._retryWithProgressIfNotConnected(progress, selector, null, false, async (result) => {
|
|
800
807
|
if (!result) return 0;
|
|
801
808
|
const handle = result[0];
|
|
802
809
|
const handles = result[1];
|
|
@@ -979,7 +986,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
979
986
|
return result;
|
|
980
987
|
}
|
|
981
988
|
async retryWithProgressAndTimeouts(progress, timeouts, action) {
|
|
982
|
-
const
|
|
989
|
+
const continuePolling = Symbol("continuePolling");
|
|
983
990
|
timeouts = [0, ...timeouts];
|
|
984
991
|
let timeoutIndex = 0;
|
|
985
992
|
while (progress.isRunning()) {
|
|
@@ -993,8 +1000,8 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
993
1000
|
}
|
|
994
1001
|
progress.throwIfAborted();
|
|
995
1002
|
try {
|
|
996
|
-
const result = await action(
|
|
997
|
-
if (result ===
|
|
1003
|
+
const result = await action(continuePolling);
|
|
1004
|
+
if (result === continuePolling)
|
|
998
1005
|
continue;
|
|
999
1006
|
return result;
|
|
1000
1007
|
} catch (e) {
|
|
@@ -1017,7 +1024,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1017
1024
|
}
|
|
1018
1025
|
async _retryWithProgressIfNotConnected(progress, selector, strict, performActionPreChecks, action, returnAction) {
|
|
1019
1026
|
progress.log("waiting for " + this._asLocator(selector));
|
|
1020
|
-
return this.retryWithProgressAndTimeouts(progress, [0, 20, 50, 100, 100, 500], async (
|
|
1027
|
+
return this.retryWithProgressAndTimeouts(progress, [0, 20, 50, 100, 100, 500], async (continuePolling) => {
|
|
1021
1028
|
if (performActionPreChecks) await this._page.performActionPreChecks(progress);
|
|
1022
1029
|
const resolved = await this.selectors.resolveInjectedForSelector(selector, {
|
|
1023
1030
|
strict
|
|
@@ -1028,29 +1035,38 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1028
1035
|
const result2 = await action(null);
|
|
1029
1036
|
return result2 === "internal:continuepolling" ? continuePolling2 : result2;
|
|
1030
1037
|
}
|
|
1031
|
-
return
|
|
1038
|
+
return continuePolling;
|
|
1032
1039
|
}
|
|
1033
1040
|
try {
|
|
1034
1041
|
var client = this._page._delegate._sessionForFrame(resolved.frame)._client;
|
|
1035
1042
|
} catch (e) {
|
|
1036
1043
|
var client = this._page._delegate._mainFrameSession._client;
|
|
1037
1044
|
}
|
|
1038
|
-
var
|
|
1045
|
+
var utilityContext = await resolved.frame._utilityContext();
|
|
1046
|
+
var mainContext = await resolved.frame._mainContext();
|
|
1039
1047
|
const documentNode = await client.send("Runtime.evaluate", {
|
|
1040
1048
|
expression: "document",
|
|
1041
1049
|
serializationOptions: {
|
|
1042
1050
|
serialization: "idOnly"
|
|
1043
1051
|
},
|
|
1044
|
-
contextId:
|
|
1052
|
+
contextId: utilityContext.delegate._contextId
|
|
1045
1053
|
});
|
|
1046
|
-
const documentScope = new dom.ElementHandle(
|
|
1047
|
-
|
|
1054
|
+
const documentScope = new dom.ElementHandle(utilityContext, documentNode.result.objectId);
|
|
1055
|
+
let currentScopingElements;
|
|
1056
|
+
try {
|
|
1057
|
+
currentScopingElements = await this._customFindElementsByParsed(resolved, client, mainContext, documentScope, progress, resolved.info.parsed);
|
|
1058
|
+
} catch (e) {
|
|
1059
|
+
if ("JSHandles can be evaluated only in the context they were created!" === e.message) return continuePolling3;
|
|
1060
|
+
await resolved.injected.evaluateHandle((injected, { error }) => {
|
|
1061
|
+
throw error;
|
|
1062
|
+
}, { error: e });
|
|
1063
|
+
}
|
|
1048
1064
|
if (currentScopingElements.length == 0) {
|
|
1049
1065
|
if (returnAction === "returnOnNotResolved" || returnAction === "returnAll") {
|
|
1050
1066
|
const result2 = await action(null);
|
|
1051
1067
|
return result2 === "internal:continuepolling" ? continuePolling2 : result2;
|
|
1052
1068
|
}
|
|
1053
|
-
return
|
|
1069
|
+
return continuePolling;
|
|
1054
1070
|
}
|
|
1055
1071
|
const resultElement = currentScopingElements[0];
|
|
1056
1072
|
if (currentScopingElements.length > 1) {
|
|
@@ -1078,9 +1094,9 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1078
1094
|
}
|
|
1079
1095
|
if (result === "error:notconnected") {
|
|
1080
1096
|
progress.log("element was detached from the DOM, retrying");
|
|
1081
|
-
return
|
|
1097
|
+
return continuePolling;
|
|
1082
1098
|
} else if (result === "internal:continuepolling") {
|
|
1083
|
-
return
|
|
1099
|
+
return continuePolling;
|
|
1084
1100
|
}
|
|
1085
1101
|
return result;
|
|
1086
1102
|
} finally {
|
|
@@ -1216,8 +1232,8 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1216
1232
|
}
|
|
1217
1233
|
async isVisibleInternal(selector, options = {}, scope) {
|
|
1218
1234
|
try {
|
|
1219
|
-
const
|
|
1220
|
-
const controller = new import_progress.ProgressController(
|
|
1235
|
+
const customMetadata = { "internal": false, "log": [], "method": "isVisible" };
|
|
1236
|
+
const controller = new import_progress.ProgressController(customMetadata, this);
|
|
1221
1237
|
return await controller.run(async (progress) => {
|
|
1222
1238
|
progress.log("waiting for " + this._asLocator(selector));
|
|
1223
1239
|
const promise = this._retryWithProgressIfNotConnected(progress, selector, options.strict, false, async (handle) => {
|
|
@@ -1350,11 +1366,11 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1350
1366
|
if (timeout < 0)
|
|
1351
1367
|
return { matches: options.isNot, log: (0, import_callLog.compressCallLog)(metadata.log), timedOut: true, received: lastIntermediateResult.received };
|
|
1352
1368
|
return await new import_progress.ProgressController(metadata, this).run(async (progress) => {
|
|
1353
|
-
return await this.retryWithProgressAndTimeouts(progress, [100, 250, 500, 1e3], async (
|
|
1369
|
+
return await this.retryWithProgressAndTimeouts(progress, [100, 250, 500, 1e3], async (continuePolling) => {
|
|
1354
1370
|
await this._page.performActionPreChecks(progress);
|
|
1355
1371
|
const { matches, received } = await this._expectInternal(progress, selector, options, lastIntermediateResult);
|
|
1356
1372
|
if (matches === options.isNot) {
|
|
1357
|
-
return
|
|
1373
|
+
return continuePolling;
|
|
1358
1374
|
}
|
|
1359
1375
|
return { matches, received };
|
|
1360
1376
|
});
|
|
@@ -1374,6 +1390,21 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1374
1390
|
progress.log("waiting for " + this._asLocator(selector));
|
|
1375
1391
|
const isArray = options.expression === "to.have.count" || options.expression.endsWith(".array");
|
|
1376
1392
|
const promise = await this._retryWithProgressIfNotConnected(progress, selector, !isArray, false, async (result) => {
|
|
1393
|
+
if (!result) {
|
|
1394
|
+
if (options.expectedNumber === 0)
|
|
1395
|
+
return { matches: true };
|
|
1396
|
+
if (!options.isNot && options.expression === "to.be.hidden")
|
|
1397
|
+
return { matches: true };
|
|
1398
|
+
if (options.isNot && options.expression === "to.be.visible")
|
|
1399
|
+
return { matches: false };
|
|
1400
|
+
if (!options.isNot && options.expression === "to.be.detached")
|
|
1401
|
+
return { matches: true };
|
|
1402
|
+
if (options.isNot && options.expression === "to.be.attached")
|
|
1403
|
+
return { matches: false };
|
|
1404
|
+
if (options.isNot && options.expression === "to.be.in.viewport")
|
|
1405
|
+
return { matches: false };
|
|
1406
|
+
return { matches: options.isNot, missingReceived: true };
|
|
1407
|
+
}
|
|
1377
1408
|
const handle = result[0];
|
|
1378
1409
|
const handles = result[1];
|
|
1379
1410
|
if (handle.parentNode.constructor.name == "ElementHandle") {
|
|
@@ -1506,7 +1537,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1506
1537
|
const controller = new import_progress.ProgressController(metadata, this);
|
|
1507
1538
|
return controller.run(async (progress) => {
|
|
1508
1539
|
progress.log("waiting for " + this._asLocator(selector));
|
|
1509
|
-
const promise = this._retryWithProgressIfNotConnected(progress, selector,
|
|
1540
|
+
const promise = this._retryWithProgressIfNotConnected(progress, selector, options.strict, false, async (handle) => {
|
|
1510
1541
|
if (handle.parentNode.constructor.name == "ElementHandle") {
|
|
1511
1542
|
return await handle.parentNode.evaluateInUtility(([injected, node, { callbackText: callbackText2, handle: handle2, taskData: taskData2 }]) => {
|
|
1512
1543
|
const callback = injected.eval(callbackText2);
|
|
@@ -1632,8 +1663,8 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1632
1663
|
var elementsIndexes = [];
|
|
1633
1664
|
if (part.name == "nth") {
|
|
1634
1665
|
const partNth = Number(part.body);
|
|
1635
|
-
if (partNth > currentScopingElements.length || partNth < -currentScopingElements.length) {
|
|
1636
|
-
|
|
1666
|
+
if (partNth > currentScopingElements.length - 1 || partNth < -(currentScopingElements.length - 1)) {
|
|
1667
|
+
throw new Error("Can't query n-th element");
|
|
1637
1668
|
} else {
|
|
1638
1669
|
currentScopingElements = [currentScopingElements.at(partNth)];
|
|
1639
1670
|
continue;
|
|
@@ -1701,7 +1732,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1701
1732
|
callId: progress.metadata.id
|
|
1702
1733
|
});
|
|
1703
1734
|
const rootElementsAmount = await rootElements.getProperty("length");
|
|
1704
|
-
queryingElements.push([rootElements, rootElementsAmount,
|
|
1735
|
+
queryingElements.push([rootElements, rootElementsAmount, scope]);
|
|
1705
1736
|
for (var queryedElement of queryingElements) {
|
|
1706
1737
|
var elementsToCheck = queryedElement[0];
|
|
1707
1738
|
var elementsAmount = await queryedElement[1].jsonValue();
|
|
@@ -1730,6 +1761,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1730
1761
|
currentScopingElements = [];
|
|
1731
1762
|
for (var element of elements) {
|
|
1732
1763
|
var elemIndex = element.backendNodeId;
|
|
1764
|
+
if (elementsIndexes.includes(elemIndex)) continue;
|
|
1733
1765
|
var elemPos = elementsIndexes.findIndex((index) => index > elemIndex);
|
|
1734
1766
|
if (elemPos === -1) {
|
|
1735
1767
|
currentScopingElements.push(element);
|
package/lib/server/javascript.js
CHANGED
|
@@ -134,7 +134,7 @@ class JSHandle extends import_instrumentation.SdkObject {
|
|
|
134
134
|
}
|
|
135
135
|
async evaluateExpressionHandle(expression, options, arg, isolatedContext) {
|
|
136
136
|
let context = this._context;
|
|
137
|
-
if (
|
|
137
|
+
if (context.constructor.name === "FrameExecutionContext") {
|
|
138
138
|
const frame = this._context.frame;
|
|
139
139
|
if (frame) {
|
|
140
140
|
if (isolatedContext) context = await frame._utilityContext();
|
package/lib/server/page.js
CHANGED
|
@@ -663,7 +663,7 @@ class Worker extends import_instrumentation.SdkObject {
|
|
|
663
663
|
}
|
|
664
664
|
async evaluateExpressionHandle(expression, isFunction, arg, isolatedContext) {
|
|
665
665
|
let context = await this._executionContextPromise;
|
|
666
|
-
if (
|
|
666
|
+
if (context.constructor.name === "FrameExecutionContext") {
|
|
667
667
|
const frame = this._context.frame;
|
|
668
668
|
if (frame) {
|
|
669
669
|
if (isolatedContext) context = await frame._utilityContext();
|
package/package.json
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ export interface Page {
|
|
|
121
121
|
* @param arg Optional argument to pass to
|
|
122
122
|
* [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression).
|
|
123
123
|
*/
|
|
124
|
-
evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg): Promise<R>;
|
|
124
|
+
evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<R>;
|
|
125
125
|
/**
|
|
126
126
|
* Returns the value of the
|
|
127
127
|
* [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression) invocation.
|
|
@@ -172,7 +172,7 @@ export interface Page {
|
|
|
172
172
|
* @param arg Optional argument to pass to
|
|
173
173
|
* [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-option-expression).
|
|
174
174
|
*/
|
|
175
|
-
evaluate<R>(pageFunction: PageFunction<void, R>, arg?: any): Promise<R>;
|
|
175
|
+
evaluate<R>(pageFunction: PageFunction<void, R>, arg?: any, isolatedContext?: boolean): Promise<R>;
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
178
|
* Returns the value of the
|
|
@@ -218,7 +218,7 @@ export interface Page {
|
|
|
218
218
|
* @param arg Optional argument to pass to
|
|
219
219
|
* [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-handle-option-expression).
|
|
220
220
|
*/
|
|
221
|
-
evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
|
|
221
|
+
evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
222
222
|
/**
|
|
223
223
|
* Returns the value of the
|
|
224
224
|
* [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-handle-option-expression) invocation as a
|
|
@@ -263,7 +263,7 @@ export interface Page {
|
|
|
263
263
|
* @param arg Optional argument to pass to
|
|
264
264
|
* [`pageFunction`](https://playwright.dev/docs/api/class-page#page-evaluate-handle-option-expression).
|
|
265
265
|
*/
|
|
266
|
-
evaluateHandle<R>(pageFunction: PageFunction<void, R>, arg?: any): Promise<SmartHandle<R>>;
|
|
266
|
+
evaluateHandle<R>(pageFunction: PageFunction<void, R>, arg?: any, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
269
|
* Adds a script which would be evaluated in one of the following scenarios:
|
|
@@ -5260,7 +5260,7 @@ export interface Frame {
|
|
|
5260
5260
|
* @param arg Optional argument to pass to
|
|
5261
5261
|
* [`pageFunction`](https://playwright.dev/docs/api/class-frame#frame-evaluate-option-expression).
|
|
5262
5262
|
*/
|
|
5263
|
-
evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg): Promise<R>;
|
|
5263
|
+
evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<R>;
|
|
5264
5264
|
/**
|
|
5265
5265
|
* Returns the return value of
|
|
5266
5266
|
* [`pageFunction`](https://playwright.dev/docs/api/class-frame#frame-evaluate-option-expression).
|
|
@@ -5307,7 +5307,7 @@ export interface Frame {
|
|
|
5307
5307
|
* @param arg Optional argument to pass to
|
|
5308
5308
|
* [`pageFunction`](https://playwright.dev/docs/api/class-frame#frame-evaluate-option-expression).
|
|
5309
5309
|
*/
|
|
5310
|
-
evaluate<R>(pageFunction: PageFunction<void, R>, arg?: any): Promise<R>;
|
|
5310
|
+
evaluate<R>(pageFunction: PageFunction<void, R>, arg?: any, isolatedContext?: boolean): Promise<R>;
|
|
5311
5311
|
|
|
5312
5312
|
/**
|
|
5313
5313
|
* Returns the return value of
|
|
@@ -5355,7 +5355,7 @@ export interface Frame {
|
|
|
5355
5355
|
* @param arg Optional argument to pass to
|
|
5356
5356
|
* [`pageFunction`](https://playwright.dev/docs/api/class-frame#frame-evaluate-handle-option-expression).
|
|
5357
5357
|
*/
|
|
5358
|
-
evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
|
|
5358
|
+
evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
5359
5359
|
/**
|
|
5360
5360
|
* Returns the return value of
|
|
5361
5361
|
* [`pageFunction`](https://playwright.dev/docs/api/class-frame#frame-evaluate-handle-option-expression) as a
|
|
@@ -5402,7 +5402,7 @@ export interface Frame {
|
|
|
5402
5402
|
* @param arg Optional argument to pass to
|
|
5403
5403
|
* [`pageFunction`](https://playwright.dev/docs/api/class-frame#frame-evaluate-handle-option-expression).
|
|
5404
5404
|
*/
|
|
5405
|
-
evaluateHandle<R>(pageFunction: PageFunction<void, R>, arg?: any): Promise<SmartHandle<R>>;
|
|
5405
|
+
evaluateHandle<R>(pageFunction: PageFunction<void, R>, arg?: any, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
5406
5406
|
|
|
5407
5407
|
/**
|
|
5408
5408
|
* **NOTE** Use locator-based [frame.locator(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-locator)
|
|
@@ -10239,7 +10239,7 @@ export interface Worker {
|
|
|
10239
10239
|
* @param arg Optional argument to pass to
|
|
10240
10240
|
* [`pageFunction`](https://playwright.dev/docs/api/class-worker#worker-evaluate-option-expression).
|
|
10241
10241
|
*/
|
|
10242
|
-
evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg): Promise<R>;
|
|
10242
|
+
evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<R>;
|
|
10243
10243
|
/**
|
|
10244
10244
|
* Returns the return value of
|
|
10245
10245
|
* [`pageFunction`](https://playwright.dev/docs/api/class-worker#worker-evaluate-option-expression).
|
|
@@ -10260,7 +10260,7 @@ export interface Worker {
|
|
|
10260
10260
|
* @param arg Optional argument to pass to
|
|
10261
10261
|
* [`pageFunction`](https://playwright.dev/docs/api/class-worker#worker-evaluate-option-expression).
|
|
10262
10262
|
*/
|
|
10263
|
-
evaluate<R>(pageFunction: PageFunction<void, R>, arg?: any): Promise<R>;
|
|
10263
|
+
evaluate<R>(pageFunction: PageFunction<void, R>, arg?: any, isolatedContext?: boolean): Promise<R>;
|
|
10264
10264
|
|
|
10265
10265
|
/**
|
|
10266
10266
|
* Returns the return value of
|
|
@@ -10283,7 +10283,7 @@ export interface Worker {
|
|
|
10283
10283
|
* @param arg Optional argument to pass to
|
|
10284
10284
|
* [`pageFunction`](https://playwright.dev/docs/api/class-worker#worker-evaluate-handle-option-expression).
|
|
10285
10285
|
*/
|
|
10286
|
-
evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
|
|
10286
|
+
evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
10287
10287
|
/**
|
|
10288
10288
|
* Returns the return value of
|
|
10289
10289
|
* [`pageFunction`](https://playwright.dev/docs/api/class-worker#worker-evaluate-handle-option-expression) as a
|
|
@@ -10305,7 +10305,7 @@ export interface Worker {
|
|
|
10305
10305
|
* @param arg Optional argument to pass to
|
|
10306
10306
|
* [`pageFunction`](https://playwright.dev/docs/api/class-worker#worker-evaluate-handle-option-expression).
|
|
10307
10307
|
*/
|
|
10308
|
-
evaluateHandle<R>(pageFunction: PageFunction<void, R>, arg?: any): Promise<SmartHandle<R>>;
|
|
10308
|
+
evaluateHandle<R>(pageFunction: PageFunction<void, R>, arg?: any, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
10309
10309
|
/**
|
|
10310
10310
|
* Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is
|
|
10311
10311
|
* terminated.
|
|
@@ -10383,7 +10383,7 @@ export interface JSHandle<T = any> {
|
|
|
10383
10383
|
* @param arg Optional argument to pass to
|
|
10384
10384
|
* [`pageFunction`](https://playwright.dev/docs/api/class-elementhandle#element-handle-evaluate-option-expression).
|
|
10385
10385
|
*/
|
|
10386
|
-
evaluate<R, Arg, O extends T = T>(pageFunction: PageFunctionOn<O, Arg, R>, arg: Arg): Promise<R>;
|
|
10386
|
+
evaluate<R, Arg, O extends T = T>(pageFunction: PageFunctionOn<O, Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<R>;
|
|
10387
10387
|
/**
|
|
10388
10388
|
* Returns the return value of
|
|
10389
10389
|
* [`pageFunction`](https://playwright.dev/docs/api/class-elementhandle#element-handle-evaluate-option-expression).
|
|
@@ -10405,7 +10405,7 @@ export interface JSHandle<T = any> {
|
|
|
10405
10405
|
* @param arg Optional argument to pass to
|
|
10406
10406
|
* [`pageFunction`](https://playwright.dev/docs/api/class-elementhandle#element-handle-evaluate-option-expression).
|
|
10407
10407
|
*/
|
|
10408
|
-
evaluate<R, O extends T = T>(pageFunction: PageFunctionOn<O, void, R>, arg?: any): Promise<R>;
|
|
10408
|
+
evaluate<R, O extends T = T>(pageFunction: PageFunctionOn<O, void, R>, arg?: any, isolatedContext?: boolean): Promise<R>;
|
|
10409
10409
|
|
|
10410
10410
|
/**
|
|
10411
10411
|
* Returns the return value of
|
|
@@ -10427,7 +10427,7 @@ export interface JSHandle<T = any> {
|
|
|
10427
10427
|
* @param arg Optional argument to pass to
|
|
10428
10428
|
* [`pageFunction`](https://playwright.dev/docs/api/class-elementhandle#element-handle-evaluate-handle-option-expression).
|
|
10429
10429
|
*/
|
|
10430
|
-
evaluateHandle<R, Arg, O extends T = T>(pageFunction: PageFunctionOn<O, Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
|
|
10430
|
+
evaluateHandle<R, Arg, O extends T = T>(pageFunction: PageFunctionOn<O, Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
10431
10431
|
/**
|
|
10432
10432
|
* Returns the return value of
|
|
10433
10433
|
* [`pageFunction`](https://playwright.dev/docs/api/class-elementhandle#element-handle-evaluate-handle-option-expression)
|
|
@@ -10448,7 +10448,7 @@ export interface JSHandle<T = any> {
|
|
|
10448
10448
|
* @param arg Optional argument to pass to
|
|
10449
10449
|
* [`pageFunction`](https://playwright.dev/docs/api/class-elementhandle#element-handle-evaluate-handle-option-expression).
|
|
10450
10450
|
*/
|
|
10451
|
-
evaluateHandle<R, O extends T = T>(pageFunction: PageFunctionOn<O, void, R>, arg?: any): Promise<SmartHandle<R>>;
|
|
10451
|
+
evaluateHandle<R, O extends T = T>(pageFunction: PageFunctionOn<O, void, R>, arg?: any, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
10452
10452
|
|
|
10453
10453
|
/**
|
|
10454
10454
|
* Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.
|
|
@@ -12204,7 +12204,7 @@ export interface Locator {
|
|
|
12204
12204
|
*/
|
|
12205
12205
|
evaluate<R, Arg, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: PageFunctionOn<E, Arg, R>, arg: Arg, options?: {
|
|
12206
12206
|
timeout?: number;
|
|
12207
|
-
}): Promise<R>;
|
|
12207
|
+
}, isolatedContext?: boolean): Promise<R>;
|
|
12208
12208
|
/**
|
|
12209
12209
|
* Execute JavaScript code in the page, taking the matching element as an argument.
|
|
12210
12210
|
*
|
|
@@ -12229,7 +12229,7 @@ export interface Locator {
|
|
|
12229
12229
|
*/
|
|
12230
12230
|
evaluate<R, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: PageFunctionOn<E, void, R>, options?: {
|
|
12231
12231
|
timeout?: number;
|
|
12232
|
-
}): Promise<R>;
|
|
12232
|
+
}, isolatedContext?: boolean): Promise<R>;
|
|
12233
12233
|
/**
|
|
12234
12234
|
* Execute JavaScript code in the page, taking the matching element as an argument, and return a
|
|
12235
12235
|
* [JSHandle](https://playwright.dev/docs/api/class-jshandle) with the result.
|
|
@@ -12262,7 +12262,7 @@ export interface Locator {
|
|
|
12262
12262
|
* [`pageFunction`](https://playwright.dev/docs/api/class-locator#locator-evaluate-handle-option-expression).
|
|
12263
12263
|
* @param options
|
|
12264
12264
|
*/
|
|
12265
|
-
evaluateHandle<R, Arg, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: PageFunctionOn<E, Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
|
|
12265
|
+
evaluateHandle<R, Arg, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: PageFunctionOn<E, Arg, R>, arg: Arg, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
12266
12266
|
/**
|
|
12267
12267
|
* Execute JavaScript code in the page, taking the matching element as an argument, and return a
|
|
12268
12268
|
* [JSHandle](https://playwright.dev/docs/api/class-jshandle) with the result.
|
|
@@ -12295,7 +12295,7 @@ export interface Locator {
|
|
|
12295
12295
|
* [`pageFunction`](https://playwright.dev/docs/api/class-locator#locator-evaluate-handle-option-expression).
|
|
12296
12296
|
* @param options
|
|
12297
12297
|
*/
|
|
12298
|
-
evaluateHandle<R, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: PageFunctionOn<E, void, R
|
|
12298
|
+
evaluateHandle<R, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: PageFunctionOn<E, void, R>, isolatedContext?: boolean): Promise<SmartHandle<R>>;
|
|
12299
12299
|
/**
|
|
12300
12300
|
* Execute JavaScript code in the page, taking all matching elements as an argument.
|
|
12301
12301
|
*
|