page._client
is used internally by puppeteer classes. As people have pointed out above, it is best, if not always to avoid using page._client
as it is a private API.
Create your own CDP Sessions page.target().createCDPSession()
to access the chrome devtools protocol directly. Things might work when you use page._client
, but when you start to try to implement some of the low level features of the devtools protocol by yourself, there are going to be some collisions and bugs that arises that aren't documented anywhere and you will be left scratching your head wondering if chrome devtools is so broken.
Example of this errors is like when you could try to use the Fetch domain directly to do proxy authentication instead of using page.authenticate(...)
. Things are going to break, and you are going to try to search the errors which are nowhere to be found, look at puppeteer source code and see you aren't doing anything different, but guess what, since you used page._client.send(...)
instead of creating your own CDPSession, you're going to pay the price of spending a whole day debugging your code.
@see: https://github.com/puppeteer/puppeteer/blob/v10.4.0/docs/api.md#class-cdpsession