From 5aa5d1d45861fedc6c057afa2384f20bd4c25faf Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Wed, 28 Jan 2026 12:51:27 +0100 Subject: [PATCH 1/2] fix: loosing session_id on target --- lib/ferrum/context.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ferrum/context.rb b/lib/ferrum/context.rb index 55c986f6..4fdfe877 100644 --- a/lib/ferrum/context.rb +++ b/lib/ferrum/context.rb @@ -61,6 +61,8 @@ def add_target(params:, session_id: nil) new_target = Target.new(@client, session_id, params) # `put_if_absent` returns nil if added a new value or existing if there was one already target = @targets.put_if_absent(new_target.id, new_target) || new_target + # on first iteration session_id may be null, then if session is present here we must set it to the target + target.session_id = session_id if session_id @default_target ||= target new_pending = Concurrent::IVar.new From 380fe59873fc0534e1505ee04de2d042677db09a Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Wed, 28 Jan 2026 12:51:44 +0100 Subject: [PATCH 2/2] fix: wss scheme for ws_url must be managed over SSL --- lib/ferrum/client/web_socket.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ferrum/client/web_socket.rb b/lib/ferrum/client/web_socket.rb index e88d73bc..55e71188 100644 --- a/lib/ferrum/client/web_socket.rb +++ b/lib/ferrum/client/web_socket.rb @@ -19,7 +19,7 @@ def initialize(url, max_receive_size, logger) uri = URI.parse(@url) port = uri.port || DEFAULT_PORTS[uri.scheme] - if port == 443 + if port == 443 || url.scheme == 'wss' tcp = TCPSocket.new(uri.host, port) ssl_context = OpenSSL::SSL::SSLContext.new @sock = OpenSSL::SSL::SSLSocket.new(tcp, ssl_context)