diff --git a/lib/ferrum/client/web_socket.rb b/lib/ferrum/client/web_socket.rb index 3f8a4de8..acacb31d 100644 --- a/lib/ferrum/client/web_socket.rb +++ b/lib/ferrum/client/web_socket.rb @@ -55,8 +55,6 @@ def on_message(event) # don't push response to @messages. Worse that could happen we raise timeout error due to command didn't return # anything or skip the background notification, but at least we don't crash the thread that crashes the main # thread and the application. - @messages.push(data) if data - output = event.data if SKIP_LOGGING_SCREENSHOTS && @screenshot_commands[data&.dig("id")] @screenshot_commands.delete(data&.dig("id")) @@ -64,6 +62,7 @@ def on_message(event) end @logger&.puts(" ◀ #{Utils::ElapsedTime.elapsed_time} #{output}\n") + @messages.push(data) if data end def on_close(_event)