小编Nik*_*ing的帖子

Page.createIsolatedWorld grantUniveralAccess 标志不授予通用访问权限

我正在尝试使用 访问跨源 iframe 的 contentDocument Runtime.evaluate。据我了解文档,这应该可以通过使用+ [1] 创建executionContext具有通用访问权限并将返回的值传递给as来实现。Page.createIsolatedWorldgrantUniveralAccess: trueexecutionContextIdRuntime.evaluatecontextId

有任何想法吗?

chromium-browser --user-data-dir=/tmp/headless --remote-debugging-port=9000给定一个从[2]开始的铬工艺。

// See [3] for full code
const frameId = /* frameId of our page with origin localhost:9000 */
function execute(command, args) { /* ... send and receive on websocket */ }

const {executionContextId} = await execute("Page.createIsolatedWorld", {
  frameId: frameId, 
  grantUniveralAccess: true // NOT grantUniversalAccess. Typo in devtools protocol itself [4].
})

// fails with:
// Access to fetch …
Run Code Online (Sandbox Code Playgroud)

puppeteer chrome-devtools-protocol

5
推荐指数
0
解决办法
722
查看次数