find_elements
Discover matching elements by selector, returning their count, tag, text, and optional HTML to inspect before taking further action.
Instructions
Find matching elements and return structured element information.
Use this tool when you need to discover how many elements match a selector, inspect their text/tag names, or inspect the HTML of multiple matches.
This tool resolves element handles immediately into ordinary JSON-like dictionaries. It does not return live SeleniumBase element objects.
Args: selector: CSS selector, or a SeleniumBase selector that can match visible text. Examples include "button", ".login-link", or 'a:contains("Sign in")'. timeout: Maximum number of seconds to wait for matching elements. Defaults to 7 seconds. include_html: If True, include each matching element's outer HTML. If False, return only tag name and text.
Returns: A dictionary containing: - count: Number of matching elements found. - matches: A list of element dictionaries containing tag_name and text, plus html when include_html=True.
Tool selection: - Need structured information about matching elements -> use find_elements. - Need the visible text/HTML of a page or a single element -> use get_content. - Need to click one of several matches -> use click with nth. - Need to know whether an element is present/visible -> use check_for_condition.
Note: Element handles cannot be persisted across MCP calls. If you find elements and then need to act on one, resolve it again with the appropriate interaction tool.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | ||
| selector | Yes | ||
| include_html | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |