English · Python
Appearance
English · Python
Appearance
The CDPSession instances are used to talk raw Chrome Devtools Protocol:
session.send method.session.on method.Useful links:
client = await page.context.new_cdp_session(page)
await client.send("Animation.enable")
client.on("Animation.animationCreated", lambda: print("animation created!"))
response = await client.send("Animation.getPlaybackRate")
print("playback rate is " + str(response["playbackRate"]))
await client.send("Animation.setPlaybackRate", {
"playbackRate": response["playbackRate"] / 2
})client = page.context.new_cdp_session(page)
client.send("Animation.enable")
client.on("Animation.animationCreated", lambda: print("animation created!"))
response = client.send("Animation.getPlaybackRate")
print("playback rate is " + str(response["playbackRate"]))
client.send("Animation.setPlaybackRate", {
"playbackRate": response["playbackRate"] / 2
})Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to send messages.
Arguments
Protocol method name.
Optional method parameters.
Returns
ObjectEmitted when the session is closed, either because the target was closed or session.detach() was called.
Event data
CDPSession