Guest User

Untitled

a guest
Oct 25th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.26 KB | None | 0 0
  1. /Users/Scwor/Desktop/+Python.Automation/python_automation/env/bin/python "/Applications/PyCharm CE.app/Contents/helpers/pycharm/_jb_pytest_runner.py" --path /Users/Scwor/Desktop/+Python.Automation/python_automation/test/test_add_group.py
  2. Testing started at 8:00 AM ...
  3. Launching py.test with arguments /Users/Scwor/Desktop/+Python.Automation/python_automation/test/test_add_group.py in /Users/Scwor/Desktop/+Python.Automation/python_automation
  4.  
  5. ============================= test session starts ==============================
  6. platform darwin -- Python 3.6.3, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
  7. rootdir: /Users/Scwor/Desktop/+Python.Automation/python_automation, inifile:
  8. collected 2 items
  9. test/test_add_group.py .F
  10. test/test_add_group.py:9 (test_add_empty_group)
  11. app = <fixture.application.Application object at 0x1039192e8>
  12.  
  13. def test_add_empty_group(app):
  14. > app.session.login(username="admin", password="secret")
  15.  
  16. test/test_add_group.py:11:
  17. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  18. fixture/session.py:9: in login
  19. wd.find_element_by_name("user").click()
  20. env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:437: in find_element_by_name
  21. return self.find_element(by=By.NAME, value=name)
  22. env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:843: in find_element
  23. 'value': value})['value']
  24. env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:308: in execute
  25. self.error_handler.check_response(response)
  26. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  27.  
  28. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x103919d30>
  29. response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: [name=\\"user\\"]",...ad_start::h823686b907c11c46\\n 10: 0x7fff8ca0893a - _pthread_body\\n 11: 0x7fff8ca08886 - _pthread_start"}}'}
  30.  
  31. def check_response(self, response):
  32. """
  33. Checks that a JSON response from the WebDriver does not have an error.
  34.  
  35. :Args:
  36. - response - The JSON response from the WebDriver server as a dictionary
  37. object.
  38.  
  39. :Raises: If the response contains an error message.
  40. """
  41. status = response.get('status', None)
  42. if status is None or status == ErrorCode.SUCCESS:
  43. return
  44. value = None
  45. message = response.get("message", "")
  46. screen = response.get("screen", "")
  47. stacktrace = None
  48. if isinstance(status, int):
  49. value_json = response.get('value', None)
  50. if value_json and isinstance(value_json, basestring):
  51. import json
  52. try:
  53. value = json.loads(value_json)
  54. if len(value.keys()) == 1:
  55. value = value['value']
  56. status = value.get('error', None)
  57. if status is None:
  58. status = value["status"]
  59. message = value["value"]
  60. if not isinstance(message, basestring):
  61. value = message
  62. message = message.get('message')
  63. else:
  64. message = value.get('message', None)
  65. except ValueError:
  66. pass
  67.  
  68. exception_class = ErrorInResponseException
  69. if status in ErrorCode.NO_SUCH_ELEMENT:
  70. exception_class = NoSuchElementException
  71. elif status in ErrorCode.NO_SUCH_FRAME:
  72. exception_class = NoSuchFrameException
  73. elif status in ErrorCode.NO_SUCH_WINDOW:
  74. exception_class = NoSuchWindowException
  75. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  76. exception_class = StaleElementReferenceException
  77. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  78. exception_class = ElementNotVisibleException
  79. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  80. exception_class = InvalidElementStateException
  81. elif status in ErrorCode.INVALID_SELECTOR \
  82. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  83. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  84. exception_class = InvalidSelectorException
  85. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  86. exception_class = ElementNotSelectableException
  87. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  88. exception_class = ElementNotInteractableException
  89. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  90. exception_class = WebDriverException
  91. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  92. exception_class = WebDriverException
  93. elif status in ErrorCode.TIMEOUT:
  94. exception_class = TimeoutException
  95. elif status in ErrorCode.SCRIPT_TIMEOUT:
  96. exception_class = TimeoutException
  97. elif status in ErrorCode.UNKNOWN_ERROR:
  98. exception_class = WebDriverException
  99. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  100. exception_class = UnexpectedAlertPresentException
  101. elif status in ErrorCode.NO_ALERT_OPEN:
  102. exception_class = NoAlertPresentException
  103. elif status in ErrorCode.IME_NOT_AVAILABLE:
  104. exception_class = ImeNotAvailableException
  105. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  106. exception_class = ImeActivationFailedException
  107. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  108. exception_class = MoveTargetOutOfBoundsException
  109. else:
  110. exception_class = WebDriverException
  111. if value == '' or value is None:
  112. value = response['value']
  113. if isinstance(value, basestring):
  114. if exception_class == ErrorInResponseException:
  115. raise exception_class(response, value)
  116. raise exception_class(value)
  117. if message == "" and 'message' in value:
  118. message = value['message']
  119.  
  120. screen = None
  121. if 'screen' in value:
  122. screen = value['screen']
  123.  
  124. stacktrace = None
  125. if 'stackTrace' in value and value['stackTrace']:
  126. stacktrace = []
  127. try:
  128. for frame in value['stackTrace']:
  129. line = self._value_or_default(frame, 'lineNumber', '')
  130. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  131. if line:
  132. file = "%s:%s" % (file, line)
  133. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  134. if 'className' in frame:
  135. meth = "%s.%s" % (frame['className'], meth)
  136. msg = " at %s (%s)"
  137. msg = msg % (meth, file)
  138. stacktrace.append(msg)
  139. except TypeError:
  140. pass
  141. if exception_class == ErrorInResponseException:
  142. raise exception_class(response, message)
  143. elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
  144. raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
  145. > raise exception_class(message, screen, stacktrace)
  146. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [name="user"]
  147.  
  148. env/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:194: NoSuchElementException
  149.  
  150.  
  151. =================================== FAILURES ===================================
  152. _____________________________ test_add_empty_group _____________________________
  153.  
  154. app = <fixture.application.Application object at 0x1039192e8>
  155.  
  156. def test_add_empty_group(app):
  157. > app.session.login(username="admin", password="secret")
  158.  
  159. test/test_add_group.py:11:
  160. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  161. fixture/session.py:9: in login
  162. wd.find_element_by_name("user").click()
  163. env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:437: in find_element_by_name
  164. return self.find_element(by=By.NAME, value=name)
  165. env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:843: in find_element
  166. 'value': value})['value']
  167. env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:308: in execute
  168. self.error_handler.check_response(response)
  169. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  170.  
  171. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x103919d30>
  172. response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: [name=\\"user\\"]",...ad_start::h823686b907c11c46\\n 10: 0x7fff8ca0893a - _pthread_body\\n 11: 0x7fff8ca08886 - _pthread_start"}}'}
  173.  
  174. def check_response(self, response):
  175. """
  176. Checks that a JSON response from the WebDriver does not have an error.
  177.  
  178. :Args:
  179. - response - The JSON response from the WebDriver server as a dictionary
  180. object.
  181.  
  182. :Raises: If the response contains an error message.
  183. """
  184. status = response.get('status', None)
  185. if status is None or status == ErrorCode.SUCCESS:
  186. return
  187. value = None
  188. message = response.get("message", "")
  189. screen = response.get("screen", "")
  190. stacktrace = None
  191. if isinstance(status, int):
  192. value_json = response.get('value', None)
  193. if value_json and isinstance(value_json, basestring):
  194. import json
  195. try:
  196. value = json.loads(value_json)
  197. if len(value.keys()) == 1:
  198. value = value['value']
  199. status = value.get('error', None)
  200. if status is None:
  201. status = value["status"]
  202. message = value["value"]
  203. if not isinstance(message, basestring):
  204. value = message
  205. message = message.get('message')
  206. else:
  207. message = value.get('message', None)
  208. except ValueError:
  209. pass
  210.  
  211. exception_class = ErrorInResponseException
  212. if status in ErrorCode.NO_SUCH_ELEMENT:
  213. exception_class = NoSuchElementException
  214. elif status in ErrorCode.NO_SUCH_FRAME:
  215. exception_class = NoSuchFrameException
  216. elif status in ErrorCode.NO_SUCH_WINDOW:
  217. exception_class = NoSuchWindowException
  218. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  219. exception_class = StaleElementReferenceException
  220. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  221. exception_class = ElementNotVisibleException
  222. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  223. exception_class = InvalidElementStateException
  224. elif status in ErrorCode.INVALID_SELECTOR \
  225. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  226. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  227. exception_class = InvalidSelectorException
  228. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  229. exception_class = ElementNotSelectableException
  230. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  231. exception_class = ElementNotInteractableException
  232. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  233. exception_class = WebDriverException
  234. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  235. exception_class = WebDriverException
  236. elif status in ErrorCode.TIMEOUT:
  237. exception_class = TimeoutException
  238. elif status in ErrorCode.SCRIPT_TIMEOUT:
  239. exception_class = TimeoutException
  240. elif status in ErrorCode.UNKNOWN_ERROR:
  241. exception_class = WebDriverException
  242. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  243. exception_class = UnexpectedAlertPresentException
  244. elif status in ErrorCode.NO_ALERT_OPEN:
  245. exception_class = NoAlertPresentException
  246. elif status in ErrorCode.IME_NOT_AVAILABLE:
  247. exception_class = ImeNotAvailableException
  248. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  249. exception_class = ImeActivationFailedException
  250. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  251. exception_class = MoveTargetOutOfBoundsException
  252. else:
  253. exception_class = WebDriverException
  254. if value == '' or value is None:
  255. value = response['value']
  256. if isinstance(value, basestring):
  257. if exception_class == ErrorInResponseException:
  258. raise exception_class(response, value)
  259. raise exception_class(value)
  260. if message == "" and 'message' in value:
  261. message = value['message']
  262.  
  263. screen = None
  264. if 'screen' in value:
  265. screen = value['screen']
  266.  
  267. stacktrace = None
  268. if 'stackTrace' in value and value['stackTrace']:
  269. stacktrace = []
  270. try:
  271. for frame in value['stackTrace']:
  272. line = self._value_or_default(frame, 'lineNumber', '')
  273. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  274. if line:
  275. file = "%s:%s" % (file, line)
  276. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  277. if 'className' in frame:
  278. meth = "%s.%s" % (frame['className'], meth)
  279. msg = " at %s (%s)"
  280. msg = msg % (meth, file)
  281. stacktrace.append(msg)
  282. except TypeError:
  283. pass
  284. if exception_class == ErrorInResponseException:
  285. raise exception_class(response, message)
  286. elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
  287. raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
  288. > raise exception_class(message, screen, stacktrace)
  289. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [name="user"]
  290.  
  291. env/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:194: NoSuchElementException
  292. ===================== 1 failed, 1 passed in 70.15 seconds ======================
  293. Process finished with exit code 0
Add Comment
Please, Sign In to add comment