Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lightpanda/async_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class AsyncSession(AsyncSessionMethods):
"""One isolated browsing context (own page, cookies, memory), async.

Do not construct directly — use :meth:`AsyncBrowser.new_session`.

Same conventions as :class:`Session` — keyword-only actions in snake_case,
``selector`` winning over ``backend_node_id``, :meth:`call` as the escape
hatch — with every method a coroutine to await.
"""

def __init__(self, session: Session, executor: ThreadPoolExecutor):
Expand Down
14 changes: 14 additions & 0 deletions lightpanda/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ class Session(SessionMethods):
"""One isolated browsing context (own page, cookies, memory).

Do not construct directly — use :meth:`Browser.new_session`.

Browser actions are keyword-only methods, named in snake_case after the
browser's own action names: the ``waitForSelector`` action is
:meth:`wait_for_selector`, and its ``backendNodeId`` argument is
``backend_node_id``.

Where a method accepts both ``selector`` and ``backend_node_id``, pass one
of the two. ``selector`` is preferred for reproducibility and wins when
both are given; ``backend_node_id`` takes the values returned by
:meth:`tree`, :meth:`links` or :meth:`find_element`.

:meth:`call` is the escape hatch that takes the action and argument names
exactly as the browser declares them. A failed action raises
:class:`ToolError`.
"""

def __init__(self, browser: Browser, session_id: str):
Expand Down
Loading