Skip to content

Commit

Permalink
Cleanup docstrings, fix broken formatting (#10838)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler authored Jul 6, 2022
1 parent a6b161a commit 09e296c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions py/selenium/webdriver/common/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,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()
Expand All @@ -65,7 +66,6 @@ async def mutation_events(self) -> dict:
assert event["attribute_name"] == "style"
assert event["current_value"] == ""
assert event["old_value"] == "display:none;"
"""

page = self.cdp.get_session_context('page.enable')
Expand Down Expand Up @@ -93,7 +93,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:
::
Expand All @@ -116,20 +116,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')
Expand Down

0 comments on commit 09e296c

Please sign in to comment.