diff --git a/py/selenium/webdriver/common/log.py b/py/selenium/webdriver/common/log.py index b64c5cd7cb9f1..cd95974314a76 100644 --- a/py/selenium/webdriver/common/log.py +++ b/py/selenium/webdriver/common/log.py @@ -54,10 +54,11 @@ def __init__(self, driver, bidi_session) -> None: @asynccontextmanager async def mutation_events(self) -> dict: """ - Listens for mutation events and emits them as it finds them + Listen for mutation events and emit them as they are found. :Usage: :: + async with driver.log.mutation_events() as event: pages.load("dynamic.html") driver.find_element(By.ID, "reveal").click() @@ -67,7 +68,6 @@ async def mutation_events(self) -> dict: assert event["attribute_name"] == "style" assert event["current_value"] == "" assert event["old_value"] == "display:none;" - """ assert sys.version_info >= (3, 7) @@ -97,7 +97,7 @@ async def mutation_events(self) -> dict: @asynccontextmanager async def add_js_error_listener(self): """ - Listens for JS errors and when the contextmanager exits check if there were JS Errors + Listen for JS errors and when the contextmanager exits check if there were JS Errors. :Usage: :: @@ -120,20 +120,19 @@ async def add_js_error_listener(self): @asynccontextmanager async def add_listener(self, event_type) -> dict: - ''' - Listens for certain events that are passed in. + """ + Listen for certain events that are passed in. :Args: - event_type: The type of event that we want to look at. - :Usage: + :Usage: :: async with driver.log.add_listener(Console.log) as messages: driver.execute_script("console.log('I like cheese')") assert messages["message"] == "I love cheese" - - ''' + """ from selenium.webdriver.common.bidi.console import Console session = self.cdp.get_session_context('page.enable')