Guest User

Untitled

a guest
Nov 10th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.93 KB | None | 0 0
  1. test_modify_contact.py F
  2. test_modify_contact.py:4 (test_modify_contact_firstname)
  3. app = <fixture.application.Application object at 0x03ED2570>
  4.  
  5. def test_modify_contact_firstname(app):
  6. app.session.login(username="admin", password="secret")
  7. > app.contact.modify_first_contact(Contact(firstname="New name"))
  8.  
  9. test_modify_contact.py:7:
  10. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  11. ..\fixture\contact.py:89: in modify_first_contact
  12. self.fill_contact_form(new_contact_data)
  13. ..\fixture\contact.py:58: in fill_contact_form
  14. Select(wd.find_element_by_name("bday")).select_by_visible_text(contact.bday)
  15. ..\env\lib\site-packages\selenium\webdriver\support\select.py:116: in select_by_visible_text
  16. xpath = ".//option[normalize-space(.) = %s]" % self._escapeString(text)
  17. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  18.  
  19. self = <selenium.webdriver.support.select.Select object at 0x03EA9D90>
  20. value = None
  21.  
  22. def _escapeString(self, value):
  23. > if '"' in value and "'" in value:
  24. E TypeError: argument of type 'NoneType' is not iterable
  25.  
  26. ..\env\lib\site-packages\selenium\webdriver\support\select.py:219: TypeError
  27. F
  28. test_modify_contact.py:10 (test_modify_contact_title)
  29. app = <fixture.application.Application object at 0x03ED2570>
  30.  
  31. def test_modify_contact_title(app):
  32. > app.session.login(username="admin", password="secret")
  33.  
  34. test_modify_contact.py:12:
  35. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  36. ..\fixture\session.py:11: in login
  37. wd.find_element_by_name("user").click()
  38. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:496: in find_element_by_name
  39. return self.find_element(by=By.NAME, value=name)
  40. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  41. 'value': value})['value']
  42. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  43. self.error_handler.check_response(response)
  44. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  45.  
  46. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x03ED2F10>
  47. response = {'status': 500, 'value': '{"value":{"error":"unknown error","message":"Failed to convert data to an object","stacktrace":""}}'}
  48.  
  49. def check_response(self, response):
  50. """
  51. Checks that a JSON response from the WebDriver does not have an error.
  52.  
  53. :Args:
  54. - response - The JSON response from the WebDriver server as a dictionary
  55. object.
  56.  
  57. :Raises: If the response contains an error message.
  58. """
  59. status = response.get('status', None)
  60. if status is None or status == ErrorCode.SUCCESS:
  61. return
  62. value = None
  63. message = response.get("message", "")
  64. screen = response.get("screen", "")
  65. stacktrace = None
  66. if isinstance(status, int):
  67. value_json = response.get('value', None)
  68. if value_json and isinstance(value_json, basestring):
  69. import json
  70. try:
  71. value = json.loads(value_json)
  72. if len(value.keys()) == 1:
  73. value = value['value']
  74. status = value.get('error', None)
  75. if status is None:
  76. status = value["status"]
  77. message = value["value"]
  78. if not isinstance(message, basestring):
  79. value = message
  80. message = message.get('message')
  81. else:
  82. message = value.get('message', None)
  83. except ValueError:
  84. pass
  85.  
  86. exception_class = ErrorInResponseException
  87. if status in ErrorCode.NO_SUCH_ELEMENT:
  88. exception_class = NoSuchElementException
  89. elif status in ErrorCode.NO_SUCH_FRAME:
  90. exception_class = NoSuchFrameException
  91. elif status in ErrorCode.NO_SUCH_WINDOW:
  92. exception_class = NoSuchWindowException
  93. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  94. exception_class = StaleElementReferenceException
  95. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  96. exception_class = ElementNotVisibleException
  97. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  98. exception_class = InvalidElementStateException
  99. elif status in ErrorCode.INVALID_SELECTOR \
  100. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  101. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  102. exception_class = InvalidSelectorException
  103. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  104. exception_class = ElementNotSelectableException
  105. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  106. exception_class = ElementNotInteractableException
  107. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  108. exception_class = InvalidCookieDomainException
  109. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  110. exception_class = UnableToSetCookieException
  111. elif status in ErrorCode.TIMEOUT:
  112. exception_class = TimeoutException
  113. elif status in ErrorCode.SCRIPT_TIMEOUT:
  114. exception_class = TimeoutException
  115. elif status in ErrorCode.UNKNOWN_ERROR:
  116. exception_class = WebDriverException
  117. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  118. exception_class = UnexpectedAlertPresentException
  119. elif status in ErrorCode.NO_ALERT_OPEN:
  120. exception_class = NoAlertPresentException
  121. elif status in ErrorCode.IME_NOT_AVAILABLE:
  122. exception_class = ImeNotAvailableException
  123. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  124. exception_class = ImeActivationFailedException
  125. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  126. exception_class = MoveTargetOutOfBoundsException
  127. elif status in ErrorCode.JAVASCRIPT_ERROR:
  128. exception_class = JavascriptException
  129. elif status in ErrorCode.SESSION_NOT_CREATED:
  130. exception_class = SessionNotCreatedException
  131. elif status in ErrorCode.INVALID_ARGUMENT:
  132. exception_class = InvalidArgumentException
  133. elif status in ErrorCode.NO_SUCH_COOKIE:
  134. exception_class = NoSuchCookieException
  135. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  136. exception_class = ScreenshotException
  137. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  138. exception_class = ElementClickInterceptedException
  139. elif status in ErrorCode.INSECURE_CERTIFICATE:
  140. exception_class = InsecureCertificateException
  141. elif status in ErrorCode.INVALID_COORDINATES:
  142. exception_class = InvalidCoordinatesException
  143. elif status in ErrorCode.INVALID_SESSION_ID:
  144. exception_class = InvalidSessionIdException
  145. elif status in ErrorCode.UNKNOWN_METHOD:
  146. exception_class = UnknownMethodException
  147. else:
  148. exception_class = WebDriverException
  149. if value == '' or value is None:
  150. value = response['value']
  151. if isinstance(value, basestring):
  152. if exception_class == ErrorInResponseException:
  153. raise exception_class(response, value)
  154. raise exception_class(value)
  155. if message == "" and 'message' in value:
  156. message = value['message']
  157.  
  158. screen = None
  159. if 'screen' in value:
  160. screen = value['screen']
  161.  
  162. stacktrace = None
  163. if 'stackTrace' in value and value['stackTrace']:
  164. stacktrace = []
  165. try:
  166. for frame in value['stackTrace']:
  167. line = self._value_or_default(frame, 'lineNumber', '')
  168. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  169. if line:
  170. file = "%s:%s" % (file, line)
  171. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  172. if 'className' in frame:
  173. meth = "%s.%s" % (frame['className'], meth)
  174. msg = " at %s (%s)"
  175. msg = msg % (meth, file)
  176. stacktrace.append(msg)
  177. except TypeError:
  178. pass
  179. if exception_class == ErrorInResponseException:
  180. raise exception_class(response, message)
  181. elif exception_class == UnexpectedAlertPresentException:
  182. alert_text = None
  183. if 'data' in value:
  184. alert_text = value['data'].get('text')
  185. elif 'alert' in value:
  186. alert_text = value['alert'].get('text')
  187. raise exception_class(message, screen, stacktrace, alert_text)
  188. > raise exception_class(message, screen, stacktrace)
  189. E selenium.common.exceptions.WebDriverException: Message: Failed to convert data to an object
  190.  
  191. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: WebDriverException
Add Comment
Please, Sign In to add comment