Skip to content

Commit f391cd0

Browse files
shbenzerVietND96
andauthored
[py] Added more internal logging for CDP (#14668)
Co-authored-by: Viet Nguyen Duc <[email protected]>
1 parent 9b8cfb1 commit f391cd0

File tree

1 file changed

+6
-0
lines changed
  • py/selenium/webdriver/common/bidi

1 file changed

+6
-0
lines changed

py/selenium/webdriver/common/bidi/cdp.py

+6
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,19 @@ async def execute(self, cmd: typing.Generator[dict, T, typing.Any]) -> T:
211211
if self.session_id:
212212
request["sessionId"] = self.session_id
213213
request_str = json.dumps(request)
214+
if logger.isEnabledFor(logging.DEBUG):
215+
logger.debug(f"Sending CDP message: {cmd_id} {cmd_event}: {request_str}")
214216
try:
215217
await self.ws.send_message(request_str)
216218
except WsConnectionClosed as wcc:
217219
raise CdpConnectionClosed(wcc.reason) from None
218220
await cmd_event.wait()
219221
response = self.inflight_result.pop(cmd_id)
222+
if logger.isEnabledFor(logging.DEBUG):
223+
logger.debug(f"Received CDP message: {response}")
220224
if isinstance(response, Exception):
225+
if logger.isEnabledFor(logging.DEBUG):
226+
logger.debug(f"Exception raised by {cmd_event} message: {type(response).__name__}")
221227
raise response
222228
return response
223229

0 commit comments

Comments
 (0)