Version: 1.10.0

CDPSession

The CDPSession instances are used to talk raw Chrome Devtools Protocol:

  • protocol methods can be called with session.send method.
  • protocol events can be subscribed to with session.on method.

Useful links:

client = page.context().new_cdp_session(page)
client.send("animation.enable")
client.on("animation.animation_created", lambda: print("animation created!"))
response = client.send("animation.get_playback_rate")
print("playback rate is " + response["playback_rate"])
client.send("animation.set_playback_rate", {
playback_rate: response["playback_rate"] / 2
})

cdp_session.detach()#

Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to send messages.

cdp_session.send(method, **kwargs)#

  • method <str> protocol method name
  • params <Dict> Optional method parameters
  • returns: <Dict>