find_elements
Locate elements matching a selector and return structured data—count, tag names, text, and optional HTML—to inspect page content or verify matches.
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 to be found. (Defaults to 0.5 seconds.) include_html: If True, include each matching element's outer HTML. If False, return only tag name and text. (Defaults to False.)
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. If there are no matching elements, returns an empty dictionary.
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_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 |