Verification¶
The Verifier class provides methods to verify elements, screens, and data integrity during test execution.
optics_framework.api.verifier.Verifier ¶
Provides methods to verify elements, screens, and data integrity.
assert_equality(output, expression, event_name=None) ¶
Compares two values for equality.
:param output: The first value to be compared. :param expression: The second value to be compared. :param event_name: The name of the event associated with the comparison, if any.
assert_presence(elements, timeout_str='30', rule='any', event_name=None, fail=True) ¶
Asserts the presence of elements.
:param elements: Comma-separated string of elements to check (Image templates, OCR templates, or XPaths). :param timeout: The time to wait for the elements in seconds. :param rule: The rule for verification ("any" or "all"). :param event_name: The name of the event associated with the assertion, if any. :return: True if the rule is satisfied, False otherwise.
capture_pagesource(event_name=None) ¶
Captures the page source of the current screen.
:param event_name: The name of the event associated with the page source capture, if any. :return: The page source as a string.
capture_screenshot(event_name=None) ¶
Captures a screenshot of the current screen.
:param event_name: The name of the event associated with the screenshot capture, if any. :return: The path to the captured screenshot.
get_interactive_elements(filter_config=None) ¶
Retrieves a list of interactive elements on the current screen.
XPath and text fields are converted to one-line, CSV-friendly form (newlines as \n, tabs as \t, etc.) so output can be pasted into elements.csv or similar.
:param filter_config: Optional list of filter types (e.g., ["buttons", "inputs"]). :type filter_config: Optional[List[str]] :return: A list of interactive elements.
get_screen_elements() ¶
Captures a screenshot and retrieves interactive elements for API response.
:return: Dict with base64-encoded screenshot and list of elements.
is_element(element, element_state, timeout, event_name=None) ¶
Checks if the specified element is in a given state (e.g., Enabled/Disabled/Visible/Invisible).
:param element: The element to be checked (Image template, OCR template, or XPath). :param element_state: The state to verify (visible, invisible, enabled, disabled). :param timeout: The time to wait for the element in seconds. :param event_name: The name of the event associated with the check, if any.
validate_element(element, timeout='10', rule='all', event_name=None) ¶
Verifies the specified element.
:param element: The element to be verified (Image template, OCR template, or XPath). :param timeout: The time to wait for verification in seconds. :param rule: The rule used for verification ("all" or "any"). :param event_name: The name of the event associated with the verification, if any.
validate_screen(elements, timeout='30', rule='any', event_name=None) ¶
Verifies the specified screen by checking element presence.
:param elements: Comma-separated string of elements to verify (Image templates, OCR templates, or XPaths). :param timeout: The time to wait for verification in seconds. :param rule: The rule for verification ("any" or "all"). :param event_name: The name of the event associated with the verification, if any.