# --- Helper Functions --- def validate_strings(result, expected_strings, exclude_strings=None): """Validate presence or absence of specific strings.""" text_content = result.text_content.replace("\\", "") for string in expected_strings: assert string in text_content if exclude_strings: for string in exclude_strings: assert string not in text_content