Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup docstrings, fix broken formatting #10838

Merged
merged 1 commit into from Jul 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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