From 4ece98330f3c48da0ad1ff9ca3133e2a782cf373 Mon Sep 17 00:00:00 2001 From: Joel Hillacre Date: Fri, 22 Mar 2013 10:13:55 +0000 Subject: [PATCH] Adding UnexpectedAlertPresentException to python bindings Signed-off-by: AutomatedTester --- py/selenium/common/exceptions.py | 3 +++ py/selenium/webdriver/remote/errorhandler.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/py/selenium/common/exceptions.py b/py/selenium/common/exceptions.py index 61a0740cc423e..57793078be2c4 100644 --- a/py/selenium/common/exceptions.py +++ b/py/selenium/common/exceptions.py @@ -65,6 +65,9 @@ class StaleElementReferenceException(WebDriverException): class InvalidElementStateException(WebDriverException): pass +class UnexpectedAlertPresentException(WebDriverException): + pass + class NoAlertPresentException(WebDriverException): pass diff --git a/py/selenium/webdriver/remote/errorhandler.py b/py/selenium/webdriver/remote/errorhandler.py index 90981d11dbe54..35979bc440464 100644 --- a/py/selenium/webdriver/remote/errorhandler.py +++ b/py/selenium/webdriver/remote/errorhandler.py @@ -25,6 +25,7 @@ from selenium.common.exceptions import NoSuchWindowException from selenium.common.exceptions import StaleElementReferenceException from selenium.common.exceptions import UnableToSetCookieException +from selenium.common.exceptions import UnexpectedAlertPresentException from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import ErrorInResponseException from selenium.common.exceptions import TimeoutException @@ -110,6 +111,8 @@ def check_response(self, response): exception_class = TimeoutException elif status == ErrorCode.UNKNOWN_ERROR: exception_class = WebDriverException + elif status == ErrorCode.UNEXPECTED_ALERT_OPEN: + exception_class = UnexpectedAlertPresentException elif status == ErrorCode.NO_ALERT_OPEN: exception_class = NoAlertPresentException elif status == ErrorCode.IME_NOT_AVAILABLE: