class Playwright::CDPSession

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

Useful links:

“`python sync 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)) client.send(“Animation.setPlaybackRate”, {

playbackRate: response["playbackRate"] / 2

}) “`

Public Instance Methods

detach() click to toggle source

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

# File lib/playwright_api/cdp_session.rb, line 28
def detach
  wrap_impl(@impl.detach)
end
off(event, callback) click to toggle source

– inherited from EventEmitter – @nodoc

# File lib/playwright_api/cdp_session.rb, line 50
def off(event, callback)
  event_emitter_proxy.off(event, callback)
end
on(event, callback) click to toggle source

– inherited from EventEmitter – @nodoc

# File lib/playwright_api/cdp_session.rb, line 44
def on(event, callback)
  event_emitter_proxy.on(event, callback)
end
once(event, callback) click to toggle source

– inherited from EventEmitter – @nodoc

# File lib/playwright_api/cdp_session.rb, line 38
def once(event, callback)
  event_emitter_proxy.once(event, callback)
end
send_message(method, params: nil) click to toggle source
# File lib/playwright_api/cdp_session.rb, line 32
def send_message(method, params: nil)
  wrap_impl(@impl.send_message(unwrap_impl(method), params: unwrap_impl(params)))
end

Private Instance Methods

event_emitter_proxy() click to toggle source
# File lib/playwright_api/cdp_session.rb, line 54
        def event_emitter_proxy
  @event_emitter_proxy ||= EventEmitterProxy.new(self, @impl)
end