Get Content
get_contentExtract visible text, HTML, or discovered URLs from a specified page element using CSS or XPath selectors. Choose the output format to get the content you need.
Instructions
Get visible text, HTML, or discovered URLs from the selected element.
Args: selector: CSS selector or SeleniumBase-supported XPath selector. Default: "body".
output_format:
- "text": Return visible text from the selected element.
- "html": Return HTML from the selected element.
- "urls": Return URLs discovered by SeleniumBase within the
selected element. Returned URLs are normalized to full URLs
with their protocol prefixes.
timeout: Maximum seconds to wait for the target element. Default: 5.Tool selection: - Need URL, title, origin, or User-Agent -> use get_page_info. - Need visible text, html, or URLs on a page -> use get_content. - Need structured information about matching elements -> use find_elements. - Need to check element presence/visibility -> use check_if_condition. - Need to wait for content to appear -> use wait_for_condition.
If there's no matching element found within the timeout, then @handle_sb_errors returns details from the exception raised.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | ||
| selector | No | body | |
| output_format | No | text |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |