report.html

Report generated on 11-Dec-2018 at 00:10:56 by pytest-html v1.19.0

Environment

Packages {'pytest': '3.6.4', 'py': '1.5.4', 'pluggy': '0.6.0'}
Platform Linux-4.19.4-300.fc29.x86_64-x86_64-with-fedora-29-Twenty_Nine
Plugins {'metadata': '1.7.0', 'html': '1.19.0', 'sourceorder': '0.5', 'multihost': '3.0'}
Python 3.7.1

Summary

24 tests ran in 911.42 seconds.

5 passed, 0 skipped, 19 failed, 0 errors, 0 expected failures, 0 unexpected passes

Results

Result Test Duration Links
Failed test_group.py::test_group::()::test_crud 18.82
self = <ipatests.test_webui.test_group.test_group object at 0x7f5e42f877f0>

@screenshot
def test_crud(self):
"""
Basic CRUD: group
"""
self.init_app()
self.basic_crud(group.ENTITY, group.DATA,
> default_facet=group.DEFAULT_FACET)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_group.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1526: in basic_crud
self.find_record(parent_entity, data, search_facet)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1337: in find_record
self.action_button_click('find', facet)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:675: in action_button_click
self._button_click(s, parent, name)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:699: in _button_click
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42e01320>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_group.py::test_group::()::test_add_and_edit_group 15.99
self = <ipatests.test_webui.test_group.test_group object at 0x7f5e42ee4c88>

@screenshot
def test_add_and_edit_group(self):
"""
1. add and switch to edit mode
2. add and cancel
"""
self.init_app()

# add and edit record
self.add_record(group.ENTITY, group.DATA, dialog_btn='add_and_edit')
> self.switch_to_facet('details')

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_group.py:190:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:497: in switch_to_facet
self.wait_for_request(0.5)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42f741d0>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_group.py::test_group::()::test_actions 18.42
self = <ipatests.test_webui.test_group.test_group object at 0x7f5e42ee5320>

@screenshot
def test_actions(self):
"""
Test group actions
"""

self.init_app()

self.add_record(group.ENTITY, group.DATA)
> self.navigate_to_record(group.PKEY)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_group.py:205:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42f443c8>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_group.py::test_group::()::test_associations 68.05
self = <ipatests.test_webui.test_group.test_group object at 0x7f5e42d30710>

@screenshot
def test_associations(self):
"""
Test group associations
"""
self.init_app()

# prepare
# -------
self.add_record(group.ENTITY, [group.DATA, group.DATA2, group.DATA3])
self.add_record(user.ENTITY, [user.DATA, user.DATA2])
self.add_record(netgroup.ENTITY, [netgroup.DATA, netgroup.DATA2])
self.add_record(rbac.ROLE_ENTITY, rbac.ROLE_DATA)
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)

# add & remove associations
# -------------------------
> self.navigate_to_record(group.PKEY, entity=group.ENTITY)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_group.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42eea080>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_group.py::test_group::()::test_indirect_associations 50.59
self = <ipatests.test_webui.test_group.test_group object at 0x7f5e42f37c18>

@screenshot
def test_indirect_associations(self):
"""
Group indirect associations
"""
self.init_app()

# add
# ---
self.add_record(group.ENTITY, [group.DATA, group.DATA2, group.DATA3,
group.DATA4, group.DATA5])
self.add_record(user.ENTITY, user.DATA)

# prepare indirect member
self.navigate_to_entity(group.ENTITY, 'search')
> self.navigate_to_record(group.PKEY2)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_group.py:301:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42f37ef0>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_crud 19.22
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42f07588>

@screenshot
def test_crud(self):
"""
Basic CRUD: user
"""
self.init_app()
data = self.add_default_email_for_validation(user.DATA)
> self.basic_crud(user.ENTITY, data)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1526: in basic_crud
self.find_record(parent_entity, data, search_facet)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1337: in find_record
self.action_button_click('find', facet)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:675: in action_button_click
self._button_click(s, parent, name)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:699: in _button_click
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42f07c18>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_associations 69.50
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42b53ba8>

@screenshot
def test_associations(self):
"""
User direct associations
"""

self.init_app()

# prepare - add user, group, netgroup, role, hbac rule, sudo rule
# ---------------------------------------------------------------
self.add_record(user.ENTITY, user.DATA, navigate=False)
self.add_record(group.ENTITY, group.DATA)
self.add_record(netgroup.ENTITY, netgroup.DATA)
self.add_record(rbac.ROLE_ENTITY, rbac.ROLE_DATA)
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)

# add & remove associations
# -------------------------
self.navigate_to_entity(user.ENTITY)
> self.navigate_to_record(user.PKEY)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:123:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42b532e8>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_indirect_associations 26.54
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42e49390>

@screenshot
def test_indirect_associations(self):
"""
User indirect associations
"""
self.init_app()

# add
# ---
self.add_record(user.ENTITY, user.DATA, navigate=False)

self.add_record(group.ENTITY, group.DATA)
> self.navigate_to_record(group.PKEY)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42e49588>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_actions 17.38
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42ab7710>

@screenshot
def test_actions(self):
"""
Test user actions
"""
self.init_app()

self.add_record(user.ENTITY, user.DATA, navigate=False)
> self.navigate_to_record(user.PKEY)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:203:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42ab7cc0>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_certificates 19.87
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42becb00>

@screenshot
def test_certificates(self):
"""
Test user certificate actions

Requires to have CA installed and 'user_csr_path' configuration option
set.
"""

if not self.has_ca():
self.skip('CA is not configured')

csr_path = self.config.get('user_csr_path')
if not csr_path:
self.skip('CSR file is not configured')

self.init_app()
# ENHANCEMENT: generate csr dynamically
csr = self.load_file(csr_path)
cert_widget_sel = "div.certificate-widget"

self.add_record(user.ENTITY, user.DATA)
self.wait()
self.close_notifications()
> self.navigate_to_record(user.PKEY)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42beccf8>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_password_expiration_notification 34.60
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42ac8f60>

@screenshot
def test_password_expiration_notification(self):
"""
Test password expiration notification
"""

pwd = self.config.get('ipa_password')

self.init_app()

self.set_ipapwdexpadvnotify('15')

# create user and group and add user to that group
self.add_record(user.ENTITY, user.DATA)
self.add_record(group.ENTITY, group.DATA)
self.navigate_to_entity(group.ENTITY)
> self.navigate_to_record(group.PKEY)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:337:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42ade1d0>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_disable_delete_admin 14.96
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42af55c0>

@screenshot
def test_disable_delete_admin(self):
"""
Test disabling/deleting admin is not allowed
"""
self.init_app()
self.navigate_to_entity(user.ENTITY)

# try to disable admin user
self.select_record('admin')
self.facet_button_click('disable')
self.dialog_button_click('ok')
> self.assert_last_error_dialog(ERR_ADMIN_DEL, details=True)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:2265: in assert_last_error_dialog
self.assert_text(s, expected_err, parent=err_dialog)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1957: in assert_text
text = self.get_text(selector, parent)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:998: in get_text
el = self.find(selector, By.CSS_SELECTOR, parent, strict=True)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:264: in find
result = func(by, expression)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:659: in find_element
{"using": by, "value": value})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:633: in _execute
return self._parent.execute(command, params)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42af5b38>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_add_user_special 20.49
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e428d3358>

@screenshot
def test_add_user_special(self):
"""
Test various add user special cases
"""

self.init_app()

# Test invalid characters (#@*?) in login
self.navigate_to_entity(user.ENTITY)
self.facet_button_click('add')
self.fill_textbox('uid', 'itest-user#')
self.assert_field_validation(ERR_INCLUDE)
self.fill_textbox('uid', 'itest-user@')
self.assert_field_validation(ERR_INCLUDE)
self.fill_textbox('uid', 'itest-user*')
self.assert_field_validation(ERR_INCLUDE)
self.fill_textbox('uid', 'itest-user?')
self.assert_field_validation(ERR_INCLUDE)
self.dialog_button_click('cancel')

# Add an user with special chars
> self.basic_crud(user.ENTITY, user.DATA_SPECIAL_CHARS)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1526: in basic_crud
self.find_record(parent_entity, data, search_facet)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1337: in find_record
self.action_button_click('find', facet)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:675: in action_button_click
self._button_click(s, parent, name)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:699: in _button_click
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42b1e198>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_add_delete_undo_reset_multivalue 19.39
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42ade2e8>

@screenshot
def test_add_delete_undo_reset_multivalue(self):
"""
Test add and delete multivalue with reset and undo
"""
self.init_app()

first_mail = self.create_email_addr(user.DATA.get('pkey'))

self.add_record(user.ENTITY, user.DATA)
self.wait()
self.close_notifications()
> self.navigate_to_record(user.DATA.get('pkey'))

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:549:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42bb82b0>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user::()::test_user_misc 39.42
self = <ipatests.test_webui.test_user.test_user object at 0x7f5e42a2c240>

@screenshot
def test_user_misc(self):
"""
Test various miscellaneous test cases under one roof to save init time
"""
self.init_app()

# add already existing user (should fail) / also test ticket 4098
self.add_record(user.ENTITY, user.DATA)
self.add_record(user.ENTITY, user.DATA, negative=True,
pre_delete=False)
self.assert_last_error_dialog(USR_EXIST.format(user.PKEY))
actions = ActionChains(self.driver)
actions.send_keys(Keys.TAB)
actions.send_keys(Keys.ENTER).perform()
self.wait(0.5)
self.dialog_button_click('cancel')

# add user without login name
self.add_record(user.ENTITY, user.DATA_NO_LOGIN)
self.assert_record('nsurname10')

# try to add same user without login name again (should fail)
self.add_record(user.ENTITY, user.DATA_NO_LOGIN, negative=True,
pre_delete=False)
self.assert_last_error_dialog(USR_EXIST.format('nsurname10'))
self.close_all_dialogs()

# try to modify user`s UID to -1 (should fail)
> self.navigate_to_record(user.PKEY)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:613:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42a58080>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user_no_private_group::()::test_noprivate_posix 20.17
self = <ipatests.test_webui.test_user.test_user_no_private_group object at 0x7f5e42a75668>

@screenshot
def test_noprivate_posix(self):
"""
User without private group and specified existing posix GID
"""
self.init_app()
self.add_record(group.ENTITY, group.DATA6)

> self.add_record(user.ENTITY, user.DATA4)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:680:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1400: in add_record
self.fill_fields(record['add'], combobox_input=combobox_input)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1263: in fill_fields
key, val, parent, combobox_input=combobox_input)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:965: in select_combobox
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42a75a58>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::test_user_no_private_group::()::test_noprivate_gidnumber 12.90
self = <ipatests.test_webui.test_user.test_user_no_private_group object at 0x7f5e428984a8>

@screenshot
def test_noprivate_gidnumber(self):
"""
User without private group and specified unused GID
"""
self.init_app()

> self.add_record(user.ENTITY, user.DATA4, combobox_input='gidnumber')

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:692:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1400: in add_record
self.fill_fields(record['add'], combobox_input=combobox_input)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1263: in fill_fields
key, val, parent, combobox_input=combobox_input)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:965: in select_combobox
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42d76240>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::TestLifeCycles::()::test_life_cycles 29.59
self = <ipatests.test_webui.test_user.TestLifeCycles object at 0x7f5e42825828>

@screenshot
def test_life_cycles(self):
"""
Test user life-cycles
"""

self.init_app()

# create "itest-user" and send him to preserved
self.add_record(user.ENTITY, user.DATA)
self.delete_record(user.PKEY, confirm_btn=None)
self.check_option('preserve', value='true')
self.dialog_button_click('ok')
self.assert_notification(assert_text='1 item(s) deleted')

# try to add the same user again (should fail)
self.add_record(user.ENTITY, user.DATA, negative=True)
self.assert_last_error_dialog(USR_EXIST.format(user.PKEY))
self.close_all_dialogs()
self.wait()

# restore "itest-user" user
> self.switch_to_facet('search_preserved')

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:721:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:497: in switch_to_facet
self.wait_for_request(0.5)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42825c50>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Failed test_user.py::TestSSHkeys::()::test_ssh_keys 10.58
self = <ipatests.test_webui.test_user.TestSSHkeys object at 0x7f5e42d76b00>

@screenshot
def test_ssh_keys(self):

self.init_app()

# add and undo SSH key
self.add_sshkey_to_record(user.SSH_RSA, 'admin', save=False,
> navigate=True)

/usr/lib/python3.7/site-packages/ipatests/test_webui/test_user.py:892:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1834: in add_sshkey_to_record
self.navigate_to_record(pkey)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1180: in navigate_to_record
self.wait_for_request()
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in wait_for_request
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py:88: in until_not
value = method(self._driver)
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:336: in <lambda>
WebDriverWait(self.driver, self.request_timeout).until_not(lambda d: runner.has_active_request())
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:315: in has_active_request
if not self.has_class(el, 'closed'):
/usr/lib/python3.7/site-packages/ipatests/test_webui/ui_driver.py:1932: in has_class
class_attr = el.get_attribute("class")
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py:141: in get_attribute
self, name)
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:636: in execute_script
'args': converted_args})['value']
/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5e42bfc9b0>
response = {'status': 500, 'value': '{"value":{"error":"unexpected alert open","message":"","stacktrace":"WebDriverError@chrome:/...content/error.js:461:5\\nGeckoDriver.prototype._handleUserPrompts@chrome://marionette/content/driver.js:3243:13\\n"}}'}

def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']

screen = None
if 'screen' in value:
screen = value['screen']

stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
> raise exception_class(message, screen, stacktrace, alert_text)
E selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
E Message:

/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:241: UnexpectedAlertPresentException
Passed test_group.py::test_group::()::test_group_types 24.34
No log output captured.
Passed test_group.py::test_group::()::test_add_group_negative 36.82
No log output captured.
Passed test_group.py::test_group::()::test_add_multiple_group 44.95
No log output captured.
Passed test_user.py::test_user::()::test_login_without_username 5.47
No log output captured.
Passed test_user.py::test_user_no_private_group::()::test_noprivate_nonposix 13.83
No log output captured.