@@ -52,10 +52,11 @@ def __init__(self, driver, bidi_session) -> None:
52
52
@asynccontextmanager
53
53
async def mutation_events (self ) -> dict :
54
54
"""
55
- Listens for mutation events and emits them as it finds them
55
+ Listen for mutation events and emit them as they are found.
56
56
57
57
:Usage:
58
58
::
59
+
59
60
async with driver.log.mutation_events() as event:
60
61
pages.load("dynamic.html")
61
62
driver.find_element(By.ID, "reveal").click()
@@ -65,7 +66,6 @@ async def mutation_events(self) -> dict:
65
66
assert event["attribute_name"] == "style"
66
67
assert event["current_value"] == ""
67
68
assert event["old_value"] == "display:none;"
68
-
69
69
"""
70
70
71
71
page = self .cdp .get_session_context ('page.enable' )
@@ -93,7 +93,7 @@ async def mutation_events(self) -> dict:
93
93
@asynccontextmanager
94
94
async def add_js_error_listener (self ):
95
95
"""
96
- Listens for JS errors and when the contextmanager exits check if there were JS Errors
96
+ Listen for JS errors and when the contextmanager exits check if there were JS Errors.
97
97
98
98
:Usage:
99
99
::
@@ -116,20 +116,19 @@ async def add_js_error_listener(self):
116
116
117
117
@asynccontextmanager
118
118
async def add_listener (self , event_type ) -> dict :
119
- '''
120
- Listens for certain events that are passed in.
119
+ """
120
+ Listen for certain events that are passed in.
121
121
122
122
:Args:
123
123
- event_type: The type of event that we want to look at.
124
124
125
- :Usage:
125
+ :Usage:
126
126
::
127
127
128
128
async with driver.log.add_listener(Console.log) as messages:
129
129
driver.execute_script("console.log('I like cheese')")
130
130
assert messages["message"] == "I love cheese"
131
-
132
- '''
131
+ """
133
132
134
133
from selenium .webdriver .common .bidi .console import Console
135
134
session = self .cdp .get_session_context ('page.enable' )
0 commit comments