Skip to content

Commit 7d825b5

Browse files
committed
Move event from_json to bidi.py
1 parent 70cdc8a commit 7d825b5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ class BidiEvent(BidiObject):
4848
def __init__(self, *args, **kwargs):
4949
super().__init__(*args, **kwargs)
5050

51+
@classmethod
52+
def from_json(cls, json):
53+
params = cls.param_class.from_json(json)
54+
return cls(params)
55+
5156

5257
@dataclass
5358
class BidiCommand(BidiObject):

py/selenium/webdriver/common/bidi/network.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ class BeforeRequestSent(BidiEvent):
165165
params: BeforeRequestSentParameters
166166
method: typing.Literal["network.beforeRequestSent"] = "network.beforeRequestSent"
167167

168-
@classmethod
169-
def from_json(cls, json):
170-
params = BeforeRequestSentParameters.from_json(json)
171-
return cls(params)
168+
param_class = BeforeRequestSentParameters
172169

173170

174171
@dataclass

0 commit comments

Comments
 (0)