Finds elements using CSS or XPath selectors with automatic type detection, optional timeout, and configurable error handling.
# Source: https://github.com/autoscrape-labs/pydoll | License: MIT | Copyright 2025 AutoscrapeLabs
# Provided via justclaw.it.com; keep this notice with the code.
async def query(
self, expression: str, timeout: int = 0, find_all: bool = False, raise_exc: bool = True
) -> Union[WebElement, list[WebElement], None]:
"""
Find element(s) using raw CSS selector or XPath expression.
Direct access using CSS or XPath syntax. Selector type automatically
determined based on expression pattern.
Args:
expression: Selector expression (CSS, XPath, ID with #, class with .).
timeout: Maximum seconds to wait for elements to appear.
find_all: If True, returns all matches; if False, first match only.
rai
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key