Skip to content

how to send message to websocket connection via cpd? #3897

Answered by mdmintz
dima23113 asked this question in Q&A
Discussion options

You must be logged in to vote

For non-UI actions using CDP, you'll first need to find a valid CDP method for it here: https://chromedevtools.github.io/devtools-protocol/ (Eg. in https://chromedevtools.github.io/devtools-protocol/tot/Network/ or https://chromedevtools.github.io/devtools-protocol/tot/Page/). And then find the Python CDP version for it available here: https://github.com/mdmintz/MyCDP.

Here's an example of calling a CDP method directly from a script:

res = await page.send(mycdp.network.get_response_body(request[1]))

There are also examples of connection.send() as part of internal methods. Eg:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants