Target 类
¥Target class
目标代表 CDP 目标。在 CDP 中,目标是可以调试的东西,例如框架、页面或工作线程。
¥Target represents a CDP target. In CDP a target is something that can be debugged such a frame, a page or a worker.
签名:
¥Signature:
export declare abstract class Target
备注
¥Remarks
此类的构造函数被标记为内部构造函数。第三方代码不应直接调用构造函数或创建扩展 Target
类的子类。
¥The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Target
class.
方法
¥Methods
方法 | 修饰符 | 描述 |
---|---|---|
asPage() | 强制为任何类型的目标创建页面。如果你想将 | |
browser() | 获取目标所属的浏览器。 | |
browserContext() | 获取目标所属的浏览器上下文。 | |
createCDPSession() | 创建附加到目标的 Chrome Devtools 协议会话。 | |
opener() | 获取打开此目标的目标。顶层目标返回 | |
page() | 如果目标不是 | |
type() | 确定这是什么类型的目标。 评论: 有关背景页面的更多信息,请参阅 docs。 | |
url() | ||
worker() | 如果目标不是 |