Skip to content

Commit f3fd759

Browse files
committed
fix: add dialog property to ConnectionHandler and manage dialog state
1 parent 2872043 commit f3fd759

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pydoll/connection/connection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def __init__(
5050
def network_logs(self):
5151
return self._events_handler.network_logs
5252

53+
@property
54+
def dialog(self):
55+
return self._events_handler.dialog
56+
5357
async def ping(self) -> bool:
5458
"""
5559
Sends a ping message to the browser.

pydoll/connection/managers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self):
4444
self._event_callbacks: Dict[int, dict] = {}
4545
self._callback_id = 0
4646
self.network_logs = []
47+
self.dialog = {}
4748
logger.info('EventsHandler initialized')
4849

4950
def register_callback(
@@ -99,6 +100,12 @@ async def process_event(self, event_data: dict):
99100
if 'Network.requestWillBeSent' in event_name:
100101
self._update_network_logs(event_data)
101102

103+
if 'Page.javascriptDialogOpening' in event_name:
104+
self.dialog = event_data
105+
106+
if 'Page.javascriptDialogClosed' in event_name:
107+
self.dialog = {}
108+
102109
# Processa callbacks
103110
await self._trigger_callbacks(event_name, event_data)
104111

0 commit comments

Comments
 (0)