Skip to content

Commit

Permalink
Improve send_command() using write_jsons() at Session
Browse files Browse the repository at this point in the history
  • Loading branch information
neyberson committed Aug 16, 2024
1 parent e30ac01 commit cc0a034
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions devtools/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,24 @@ def send_command(self, command, params=None, cb=None):
"method": command,
}

if self.session_id != "":
json_command["session_id"] = self.session_id

if params:
json_command["params"] = params

if self.session_id != "":
json_command["session_id"] = self.session_id
self.parent_connection.browser_pipe.write_jsons(
message_id=json_command["id"],
method=json_command["method"],
params=json_command["params"],
session_id=self.session_id,
)
else:
self.parent_connection.browser_pipe.write_jsons(
message_id=json_command["id"],
method=json_command["method"],
session_id=self.session_id,
)

self.message_id += 1

Expand Down

0 comments on commit cc0a034

Please sign in to comment.