Exception Handling
Overview
WebRunner provides a hierarchy of custom exceptions for specific error scenarios.
All exceptions inherit from WebRunnerException.
Exception Hierarchy
WebRunnerException (base)
├── WebRunnerWebDriverNotFoundException
├── WebRunnerOptionsWrongTypeException
├── WebRunnerArgumentWrongTypeException
├── WebRunnerWebDriverIsNoneException
├── WebRunnerExecuteException
├── WebRunnerAssertException
├── WebRunnerHTMLException
├── WebRunnerAddCommandException
├── WebRunnerJsonException
│ └── WebRunnerGenerateJsonReportException
├── XMLException
│ └── XMLTypeException
└── CallbackExecutorException
Exception Reference
Exception |
Description |
|---|---|
|
Base exception for all WebRunner errors |
|
WebDriver not found or browser name not supported |
|
Invalid options type provided (must be list or set) |
|
Invalid argument type provided |
|
WebDriver is None (not initialized) |
|
Error during action execution (unknown command, invalid format) |
|
JSON processing error |
|
JSON report generation error |
|
Assertion validation failure |
|
HTML report generation error (e.g., no test records) |
|
Error registering custom command (not a function/method) |
|
XML processing error |
|
Invalid XML type specified (must be |
|
Callback execution error (bad trigger function or method) |
Example
from je_web_runner import get_webdriver_manager
from je_web_runner.utils.exception.exceptions import (
WebRunnerException,
WebRunnerWebDriverNotFoundException,
)
try:
manager = get_webdriver_manager("unsupported_browser")
except WebRunnerWebDriverNotFoundException as e:
print(f"Browser not supported: {e}")
except WebRunnerException as e:
print(f"WebRunner error: {e}")