gpt4 book ai didi

google-chrome - chrome DevTools 协议(protocol)中的浏览器目标是什么?

转载 作者:行者123 更新时间:2023-12-01 13:28:02 24 4
gpt4 key购买 nike

在chrome DevTools协议(protocol)的主站,有一个section对于 目标域 .

在 puppeteer 库中,有一个 JS 类,它只有几个方法。

目标是什么,目的是什么?

最佳答案

一个 目标 ,如您的问题中所述,可以是页面、背景页面、服务人员、浏览器等。
换句话说,目标本质上是焦点所在的当前帧或环境。

Chrome DevTools Protocol Documentation将目标域描述为:

Target Domain

Supports additional targets discovery and allows to attach to them.



Puppeteer ,一个 Node.js 库,它提供了一个高级 API 来通过 DevTools 协议(protocol)控制 Chrome 或 Chromium,它的 Target 类是 documented如下:

class: Target

target.browser()

Get the browser the target belongs to.

target.browserContext()

The browser context the target belongs to.

target.createCDPSession()

Creates a Chrome Devtools Protocol session attached to the target.

target.opener()

Get the target that opened this target. Top-level targets return null.

target.page()

If the target is not of type "page" or "background_page", returns null.

target.type()

Identifies what kind of target this is. Can be "page", "background_page", "service_worker", "browser" or "other".

target.url()

关于google-chrome - chrome DevTools 协议(protocol)中的浏览器目标是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47480154/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com