Skip to content

Commit

Permalink
Fix Typo and add Try-Catch Statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinyzu committed Jan 4, 2025
1 parent 254a191 commit ea18a90
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions patchright_driver_patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,19 +432,21 @@ onClearLifecycleBody.insertStatements(0, "this._isolatedWorld = undefined;");
}
}
return 0;`;*/
const getFrameMainFrameContextIdCode = `var globalDocument = await client._sendMayFail("DOM.getFrameOwner", {frameId: this._id,});
if (globalDocument && globalDocument.nodeId) {
var descibedNode = await client._sendMayFail("DOM.describeNode", {
backendNodeId: globalDocument.backendNodeId,
});
if (descibedNode) {
var resolvedNode = await client._sendMayFail("DOM.resolveNode", {
nodeId: descibedNode.node.contentDocument.nodeId,
const getFrameMainFrameContextIdCode = `try {
var globalDocument = await client._sendMayFail("DOM.getFrameOwner", {frameId: this._id,});
if (globalDocument && globalDocument.nodeId) {
var describedNode = await client._sendMayFail("DOM.describeNode", {
backendNodeId: globalDocument.backendNodeId,
});
var _executionContextId = parseInt(resolvedNode.object.objectId.split(".")[1], 10);
return _executionContextId;
if (describedNode) {
var resolvedNode = await client._sendMayFail("DOM.resolveNode", {
nodeId: describedNode.node.contentDocument.nodeId,
});
var _executionContextId = parseInt(resolvedNode.object.objectId.split(".")[1], 10);
return _executionContextId;
}
}
}
} catch (e) {}
return 0;`;

// Add the method to the class
Expand Down

0 comments on commit ea18a90

Please sign in to comment.