class Playwright::CDPSession
“‘
})
playbackRate: response / 2
client.send(“Animation.setPlaybackRate”, {
print(“playback rate is ” + str(response))
response = client.send(“Animation.getPlaybackRate”)
client.on(“Animation.animationCreated”, lambda: print(“animation created!”))
client.send(“Animation.enable”)
client = page.context.new_cdp_session(page)
“`python sync
- Getting Started with DevTools Protocol: github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md<br>- Documentation on DevTools Protocol can be found here: [DevTools Protocol Viewer](chromedevtools.github.io/devtools-protocol/).
Useful links:
- protocol events can be subscribed to with `session.on` method.
- protocol methods can be called with `session.send` method.
The `CDPSession` instances are used to talk raw Chrome Devtools Protocol:
- extends: [EventEmitter]
def detach
Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to
def detach wrap_impl(@impl.detach) end
def event_emitter_proxy
def event_emitter_proxy _emitter_proxy ||= EventEmitterProxy.new(self, @impl)
def off(event, callback)
-- inherited from EventEmitter --
def off(event, callback) event_emitter_proxy.off(event, callback) end
def on(event, callback)
-- inherited from EventEmitter --
def on(event, callback) event_emitter_proxy.on(event, callback) end
def once(event, callback)
-- inherited from EventEmitter --
def once(event, callback) event_emitter_proxy.once(event, callback) end
def send_message(method, params: nil)
def send_message(method, params: nil) wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params))) end