# class:target
### class: Target v0.9.0
#### Methods
- [target.browser()](#?product=Puppeteer&version=v1.11.0&show=api-targetbrowser)v0.9.0
- [target.browserContext()](#?product=Puppeteer&version=v1.11.0&show=api-targetbrowsercontext)v0.9.0
- [target.createCDPSession()](#?product=Puppeteer&version=v1.11.0&show=api-targetcreatecdpsession)v0.9.0
- [target.opener()](#?product=Puppeteer&version=v1.11.0&show=api-targetopener)v0.9.0
- [target.page()](#?product=Puppeteer&version=v1.11.0&show=api-targetpage)v0.9.0
- [target.type()](#?product=Puppeteer&version=v1.11.0&show=api-targettype)v0.9.0
- [target.url()](#?product=Puppeteer&version=v1.11.0&show=api-targeturl)v0.9.0
### Methods
#### target.browser()v0.9.0
- returns: <[Browser](#?product=Puppeteer&version=v1.11.0&show=api-class-browser "Browser")>
获取目标所属的浏览器。
#### target.browserContext()v0.9.0
- returns: <[BrowserContext](#?product=Puppeteer&version=v1.11.0&show=api-class-browsercontext "BrowserContext")>
目标所属的浏览器上下文。
#### target.createCDPSession()v0.9.0
- returns: <[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise")<[CDPSession](#?product=Puppeteer&version=v1.11.0&show=api-class-cdpsession "CDPSession")>>
创建一个 Chrome Devtools 协议会话至目标。
#### target.opener()v0.9.0
- returns: <?[Target](#?product=Puppeteer&version=v1.11.0&show=api-class-target "Target")>
获取打开此目标的目标。 顶级目标返回`null`。
#### target.page()v0.9.0
- returns: <[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise")<?[Page](#?product=Puppeteer&version=v1.11.0&show=api-class-page "Page")>>
如果目标不是 `"page"` 或 `"background_page"` 类型,则返回 `null`。
#### target.type()v0.9.0
- returns: <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")>
确定目标是怎么样的类型。 可以是 `"page"`,[`"background_page"`](https://developer.chrome.com/extensions/background_pages),`"service_worker"`,`"browser"` 或 `"其他"`。
#### target.url()v0.9.0
- returns: <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "String")>
![](images/pptr.png)
puppeteer.js中文网|class:target
puppeteer.js中文文档, puppeteer chrome, puppeteer firefox, puppeteer api 中文文档
puppeteer.js中文网包含了Puppeteer中文文档,最新资讯,应用案例等。Puppeteer 是一个 Node 库,它提供了一个高级 API 来通过 DevTools 协议控制 Chromium 或 Chrome。
- Introduction
- 版本记录
- 概要
- puppeteer-vs-puppeteer-core
- 环境变量
- error-handling
- working-with-chrome-extensions
- class:puppeteer
- class:browserfetcher
- class:browser
- class:page
- class:worker
- class:accessibility
- class:keyboard
- class:mouse
- class:touchscreen
- class:tracing
- class:dialog
- class:consolemessage
- class:frame
- class:executioncontext
- class:jshandle
- class:elementhandle
- class:request
- class:response
- class:securitydetails
- class:target
- class:cdpsession
- class:coverage
- class:timeouterror