Exceptions¶
All Dolphin exceptions inherit from DolphinError.
DolphinError
¶
ElementNotFoundError
¶
Bases: DolphinError
Raised when an element cannot be found within the timeout.
WaitTimeoutError
¶
Bases: DolphinError
Raised when a wait condition is not met within the allowed time.
ApplicationError
¶
Bases: DolphinError
Raised when application launch or connection fails.
WindowNotFoundError
¶
Bases: DolphinError
Raised when a window cannot be found.
AliasNotFoundError
¶
Bases: DolphinError
Raised when an alias is not found in the Object Repository.
Catching exceptions¶
from dolphin_desktop import DolphinError, ElementNotFoundError, WaitTimeoutError
# Catch any Dolphin error
try:
win.get_by_title("Submit").click()
except DolphinError as e:
print(f"Dolphin error: {e}")
# Catch element not found specifically
try:
win.get_by_automation_id("btnSubmit").timeout(5).click()
except ElementNotFoundError:
# Fall back to image matching
from dolphin_desktop import ImageLocator
ImageLocator("templates/submit.png").click()
# Catch wait timeout
try:
win.get_by_title("Loading...").wait_until_hidden(timeout=30)
except WaitTimeoutError:
raise AssertionError("Loading never finished")