diff --git a/playwright/_impl/_connection.py b/playwright/_impl/_connection.py index a837500b1..65bcf48c8 100644 --- a/playwright/_impl/_connection.py +++ b/playwright/_impl/_connection.py @@ -367,7 +367,6 @@ def _send_message_to_server( getattr(task, "__pw_stack_trace__", traceback.extract_stack(limit=10)), ) callback.no_reply = no_reply - self._callbacks[id] = callback stack_trace_information = cast(ParsedStackTrace, self._api_zone.get()) frames = stack_trace_information.get("frames", []) location = ( @@ -399,8 +398,8 @@ def _send_message_to_server( if self._tracing_count > 0 and frames and object._guid != "localUtils": self.local_utils.add_stack_to_tracing_no_reply(id, frames) - self._transport.send(message) self._callbacks[id] = callback + self._transport.send(message) return callback