tool_get_elements
Get multiple elements from a webpage using a CSS or XPath selector and return their text content and outer HTML.
Instructions
Get multiple elements matching a selector.
This tool finds all elements matching the selector and returns their text
content and HTML.
Args:
selector (str): The selector to find the elements
by (str, optional): The selector type. Either "css" or "xpath". Defaults to "css"
Returns:
Dict[str, Any]: A dictionary containing:
- success (bool): Whether the operation was successful
- message (str): Status message
- data (List[Dict]): List of elements, each containing:
- text (str): The text content of the element
- html (str): The outer HTML of the element
Example:
{"tool": "get_elements", "args": {"selector": ".item"}}
{"tool": "get_elements", "args": {"selector": "//li[@class='item']", "by": "xpath"}}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | ||
| by | No | css |