Skip to content

Commit 46a2f63

Browse files
committed
Expose hook to log CDP messages
1 parent bd578fb commit 46a2f63

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/ferrum/client.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Client
6464
delegate %i[timeout timeout=] => :options
6565

6666
attr_reader :ws_url, :options, :subscriber
67-
67+
attr_accessor :on_syncronous_message
6868
def initialize(ws_url, options)
6969
@command_id = 0
7070
@ws_url = ws_url
@@ -96,6 +96,9 @@ def send_message(message, async:)
9696
raise TimeoutError unless data
9797

9898
error, response = data.values_at("error", "result")
99+
if on_syncronous_message
100+
on_syncronous_message.call(message:, error:, response:)
101+
end
99102
raise_browser_error(error) if error
100103
response
101104
end

0 commit comments

Comments
 (0)