Skip to content

Commit 560a0ae

Browse files
p0dejepujagani
andcommitted
Support secure WebSocket in DevTools
Co-Authored-By: Puja Jagani <puja.jagani93@gmail.com>
1 parent e5d3644 commit 560a0ae

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

rb/lib/selenium/webdriver/devtools.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,18 @@ def wait
161161
end
162162

163163
def socket
164-
@socket ||= TCPSocket.new(ws.host, ws.port)
164+
@socket ||= begin
165+
if URI(@url).scheme == 'ws'
166+
socket = TCPSocket.new(ws.host, ws.port)
167+
socket = OpenSSL::SSL::SSLSocket.new(socket, OpenSSL::SSL::SSLContext.new)
168+
socket.sync_close = true
169+
socket.connect
170+
171+
socket
172+
else
173+
TCPSocket.new(ws.host, ws.port)
174+
end
175+
end
165176
end
166177

167178
def ws

0 commit comments

Comments
 (0)