Updated script that can be controled by Nodejs web app
This commit is contained in:
20
lib/python3.13/site-packages/selenium/webdriver/common/devtools/v130/util.py
Executable file
20
lib/python3.13/site-packages/selenium/webdriver/common/devtools/v130/util.py
Executable file
@ -0,0 +1,20 @@
|
||||
|
||||
import typing
|
||||
|
||||
|
||||
T_JSON_DICT = typing.Dict[str, typing.Any]
|
||||
_event_parsers = dict()
|
||||
|
||||
|
||||
def event_class(method):
|
||||
''' A decorator that registers a class as an event class. '''
|
||||
def decorate(cls):
|
||||
_event_parsers[method] = cls
|
||||
cls.event_class = method
|
||||
return cls
|
||||
return decorate
|
||||
|
||||
|
||||
def parse_json_event(json: T_JSON_DICT) -> typing.Any:
|
||||
''' Parse a JSON dictionary into a CDP event. '''
|
||||
return _event_parsers[json['method']].from_json(json['params'])
|
Reference in New Issue
Block a user