assert_condition
Verify expected browser conditions like element visibility, text, title, or URL, and fail the test when they aren't met. Use for explicit verification instead of passive checks.
Instructions
Verify an expected browser condition and fail when it is not met.
Use this tool for explicit verification. Unlike check_for_condition, which simply reports True or False on the current state, assert_condition treats a failed expectation as an error. Unlike wait_for, URL/title checks do not wait.
Args: check: - "element_present": Verify selector identifies a present element. - "element_visible": Verify selector identifies a visible element. - "text_visible": Verify expected text is visible within selector, or within the whole HTML document when selector is omitted. - "title": Verify the exact page title. - "url": Verify the exact current URL. - "url_contains": Verify that the current URL contains expected. selector: Element selector for element_present, element_visible, and text_visible checks. expected: Expected text/title/URL value for text_visible, title, url, and url_contains. exact: For check="text_visible", require exact text rather than a substring. timeout: Maximum seconds to wait for element/text checks.
Returns: A confirmation when the expectation passes.
Raises: An assertion-related SeleniumBase exception when the expectation fails; the MCP error wrapper converts it to a descriptive result.
Tool selection: - Just inspect current state -> use check_for_condition. - Wait for a condition to become true -> use wait_for. - Verify that an expected condition is true -> use assert_condition.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| check | No | element_visible | |
| exact | No | ||
| timeout | No | ||
| expected | No | ||
| selector | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |