-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
Hi! Please share the method of sending a message to a websocket connection.
I open a site, it has a websocket connection and I want to send something there, I just don't understand how
Beta Was this translation helpful? Give feedback.
All reactions
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:
There are also examples of connection.send()
as part of internal methods. Eg:
Replies: 1 comment
-
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:
There are also examples of connection.send()
as part of internal methods. Eg:
From within a script, you can access the send()
method from a Tab
object. Eg:
tab = sb.cdp.get_active_tab() tab.send(mycdp.DOMAIN.METHOD_NAME(ARGS))
For example, mycdp.page.navigate(URL)
is a CDP call that can be sent via the send()
method.
To use mycdp
directly in a SeleniumBase script, be sure to import it first:
import mycdp
Beta Was this translation helpful? Give feedback.