Skip to content

Commit

Permalink
Cleanup docstrings, fix broken formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Jul 3, 2022
1 parent 2fbfc62 commit 04586ee
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions py/selenium/webdriver/common/log.py
Expand Up @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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:
::
Expand All @@ -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')
Expand Down

0 comments on commit 04586ee

Please sign in to comment.