Class: Playwright::CDPSession

Inherits:
PlaywrightApi show all
Defined in:
lib/playwright_api/cdp_session.rb

Overview

  • extends: [EventEmitter]

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:

“‘python sync 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) client.send(“animation.set_playback_rate”,

playback_rate: response["playback_rate"] / 2

) “‘

Instance Method Summary collapse

Methods inherited from PlaywrightApi

#initialize, wrap

Constructor Details

This class inherits a constructor from Playwright::PlaywrightApi

Instance Method Details

#detachObject

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

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/playwright_api/cdp_session.rb', line 28

def detach
  raise NotImplementedError.new('detach is not implemented yet.')
end

#send_message(method, params: nil) ⇒ Object

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/playwright_api/cdp_session.rb', line 32

def send_message(method, params: nil)
  raise NotImplementedError.new('send_message is not implemented yet.')
end