Wraps a DOM element for browser automation via CDP, providing interaction (click, type), inspection (attributes, visibility), and manipulation (screenshot, shadow DOM) with iframe-aware routing.
class WebElement(FindElementsMixin): # noqa: PLR0904
"""
DOM element wrapper for browser automation.
Provides comprehensive functionality for element interaction, inspection,
and manipulation using Chrome DevTools Protocol commands.
"""
if TYPE_CHECKING:
_routing_session_handler: Optional[ConnectionHandler]
_routing_session_id: Optional[str]
_routing_parent_frame_id: Optional[str]
def __init__(
self,
object_id: str,
connection_handler: ConnectionHandler,
method: Optional[str] = None,
selector: Optional[str] = None,
attributes_list: Optional[list[str]] = None,
mouse: Optional['MouseType'] = None,
):
"""
Initialize WebElement wrapper.
Args:
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key