check_if_condition
Determine if a page element is present or visible, or if specific text is currently visible, returning an immediate True/False without waiting.
Instructions
Check the current state of an element or text without waiting for the condition to become true.
Use this tool when you need an immediate boolean observation of the current page state. Use wait_for_condition when the condition may become true later and the workflow should wait for it. Use assert_condition when the condition is an expected requirement and failure should be treated as an assertion error.
Args:
check:
The element state to inspect when text is not provided:
- "present": Return True when at least one matching element exists.
- "visible": Return True when the matching element is visible.
check is ignored when text is provided.
selector:
CSS selector or SeleniumBase selector identifying the element.
text:
Optional text to check for visibility within `selector`. When
provided, this takes precedence over `check`; the tool checks text
visibility instead of element presence or visibility. Use this when
the question is "Is this text currently visible?" rather than
whether the element itself is present or visible.Returns: True or False indicating whether the requested condition is currently satisfied. Missing elements return False rather than raising an exception. If there's an error, returns a string with error details.
Tool selection: - Immediate boolean observation -> use check_if_condition. - Wait for a state/content transition -> use wait_for_condition. - Verify an expected condition -> use assert_condition. - Need element details of matching elements -> use find_elements. - Need to read page or element content -> use get_content.
Notes: This tool does not intentionally wait for elements or text to appear. It is intended for checking the current state only. If page timing or asynchronous loading matters, use wait_for_condition instead.
When `text` is provided, `check` is ignored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | ||
| check | No | visible | |
| selector | No | body |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |