Locates web elements by combining common HTML attributes (id, class, name, tag, text) into a single flexible method, supporting timeouts and multiple matches.
async def find(
self,
id: Optional[str] = None,
class_name: Optional[str] = None,
name: Optional[str] = None,
tag_name: Optional[str] = None,
text: Optional[str] = None,
timeout: int = 0,
find_all: bool = False,
raise_exc: bool = True,
**attributes: dict[str, str],
) -> Union[WebElement, list[WebElement], None]:
"""
Find element(s) using combination of common HTML attributes.
Flexible element location using standard attributes. Multiple attributes
can be combined for specific selectors (builds XPath when multiple specified).
Args:
id: Element ID attribute value.
class_name: CSS class name to match.
name: Element name attribute
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key