Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2017
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.41 KB | None | 0 0
  1. ============================= test session starts =============================
  2. platform win32 -- Python 3.6.2, pytest-3.2.2, py-1.4.34, pluggy-0.4.0
  3. rootdir: C:\Users\Mihail\Documents\GitHub\python_training\test, inifile:
  4. collected 1 item
  5. test_del_user.py F
  6. test_del_user.py:3 (test_delete_user)
  7. app = <fixture.application.Application object at 0x037AB730>
  8.  
  9. def test_delete_user(app):
  10. if app.user.count() == 0:
  11. app.user.create(
  12. User(name="new", surname="new", email="new", mobile="new", phone="new", company="new", address="new",
  13. middle="new", nickname="new"))
  14. > old_users = app.user.get_user_list()
  15.  
  16. test_del_user.py:9:
  17. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  18. ..\fixture\user.py:104: in get_user_list
  19. id = element.find_element_by_name("selected[]").get_attribute("value")
  20. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:184: in find_element_by_name
  21. return self.find_element(by=By.NAME, value=name)
  22. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:518: in find_element
  23. {"using": by, "value": value})['value']
  24. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:501: in _execute
  25. return self._parent.execute(command, params)
  26. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:308: in execute
  27. self.error_handler.check_response(response)
  28. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  29.  
  30. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x037B26F0>
  31. response = {'status': 500, 'value': '{"name":"findChildElement","sessionId":"22740ded-6454-4b23-87d4-4b4465156534","status":7,"va...pw4zugn82/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13298,"columnNumber":5}]}}'}
  32.  
  33. def check_response(self, response):
  34. """
  35. Checks that a JSON response from the WebDriver does not have an error.
  36.  
  37. :Args:
  38. - response - The JSON response from the WebDriver server as a dictionary
  39. object.
  40.  
  41. :Raises: If the response contains an error message.
  42. """
  43. status = response.get('status', None)
  44. if status is None or status == ErrorCode.SUCCESS:
  45. return
  46. value = None
  47. message = response.get("message", "")
  48. screen = response.get("screen", "")
  49. stacktrace = None
  50. if isinstance(status, int):
  51. value_json = response.get('value', None)
  52. if value_json and isinstance(value_json, basestring):
  53. import json
  54. try:
  55. value = json.loads(value_json)
  56. if len(value.keys()) == 1:
  57. value = value['value']
  58. status = value.get('error', None)
  59. if status is None:
  60. status = value["status"]
  61. message = value["value"]
  62. if not isinstance(message, basestring):
  63. value = message
  64. message = message.get('message')
  65. else:
  66. message = value.get('message', None)
  67. except ValueError:
  68. pass
  69.  
  70. exception_class = ErrorInResponseException
  71. if status in ErrorCode.NO_SUCH_ELEMENT:
  72. exception_class = NoSuchElementException
  73. elif status in ErrorCode.NO_SUCH_FRAME:
  74. exception_class = NoSuchFrameException
  75. elif status in ErrorCode.NO_SUCH_WINDOW:
  76. exception_class = NoSuchWindowException
  77. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  78. exception_class = StaleElementReferenceException
  79. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  80. exception_class = ElementNotVisibleException
  81. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  82. exception_class = InvalidElementStateException
  83. elif status in ErrorCode.INVALID_SELECTOR \
  84. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  85. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  86. exception_class = InvalidSelectorException
  87. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  88. exception_class = ElementNotSelectableException
  89. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  90. exception_class = ElementNotInteractableException
  91. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  92. exception_class = WebDriverException
  93. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  94. exception_class = WebDriverException
  95. elif status in ErrorCode.TIMEOUT:
  96. exception_class = TimeoutException
  97. elif status in ErrorCode.SCRIPT_TIMEOUT:
  98. exception_class = TimeoutException
  99. elif status in ErrorCode.UNKNOWN_ERROR:
  100. exception_class = WebDriverException
  101. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  102. exception_class = UnexpectedAlertPresentException
  103. elif status in ErrorCode.NO_ALERT_OPEN:
  104. exception_class = NoAlertPresentException
  105. elif status in ErrorCode.IME_NOT_AVAILABLE:
  106. exception_class = ImeNotAvailableException
  107. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  108. exception_class = ImeActivationFailedException
  109. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  110. exception_class = MoveTargetOutOfBoundsException
  111. else:
  112. exception_class = WebDriverException
  113. if value == '' or value is None:
  114. value = response['value']
  115. if isinstance(value, basestring):
  116. if exception_class == ErrorInResponseException:
  117. raise exception_class(response, value)
  118. raise exception_class(value)
  119. if message == "" and 'message' in value:
  120. message = value['message']
  121.  
  122. screen = None
  123. if 'screen' in value:
  124. screen = value['screen']
  125.  
  126. stacktrace = None
  127. if 'stackTrace' in value and value['stackTrace']:
  128. stacktrace = []
  129. try:
  130. for frame in value['stackTrace']:
  131. line = self._value_or_default(frame, 'lineNumber', '')
  132. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  133. if line:
  134. file = "%s:%s" % (file, line)
  135. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  136. if 'className' in frame:
  137. meth = "%s.%s" % (frame['className'], meth)
  138. msg = " at %s (%s)"
  139. msg = msg % (meth, file)
  140. stacktrace.append(msg)
  141. except TypeError:
  142. pass
  143. if exception_class == ErrorInResponseException:
  144. raise exception_class(response, message)
  145. elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
  146. raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
  147. > raise exception_class(message, screen, stacktrace)
  148. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"name","selector":"selected[]"}
  149. E Stacktrace:
  150. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/driver-component.js:10484)
  151. E at FirefoxDriver.prototype.findChildElement (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/driver-component.js:10496)
  152. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/command-processor.js:13351)
  153. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/command-processor.js:13356)
  154. E at DelayedCommand.prototype.execute/< (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/command-processor.js:13298)
  155.  
  156. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:194: NoSuchElementException
  157.  
  158.  
  159. ================================== FAILURES ===================================
  160. ______________________________ test_delete_user _______________________________
  161.  
  162. app = <fixture.application.Application object at 0x037AB730>
  163.  
  164. def test_delete_user(app):
  165. if app.user.count() == 0:
  166. app.user.create(
  167. User(name="new", surname="new", email="new", mobile="new", phone="new", company="new", address="new",
  168. middle="new", nickname="new"))
  169. > old_users = app.user.get_user_list()
  170.  
  171. test_del_user.py:9:
  172. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  173. ..\fixture\user.py:104: in get_user_list
  174. id = element.find_element_by_name("selected[]").get_attribute("value")
  175. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:184: in find_element_by_name
  176. return self.find_element(by=By.NAME, value=name)
  177. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:518: in find_element
  178. {"using": by, "value": value})['value']
  179. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:501: in _execute
  180. return self._parent.execute(command, params)
  181. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:308: in execute
  182. self.error_handler.check_response(response)
  183. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  184.  
  185. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x037B26F0>
  186. response = {'status': 500, 'value': '{"name":"findChildElement","sessionId":"22740ded-6454-4b23-87d4-4b4465156534","status":7,"va...pw4zugn82/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13298,"columnNumber":5}]}}'}
  187.  
  188. def check_response(self, response):
  189. """
  190. Checks that a JSON response from the WebDriver does not have an error.
  191.  
  192. :Args:
  193. - response - The JSON response from the WebDriver server as a dictionary
  194. object.
  195.  
  196. :Raises: If the response contains an error message.
  197. """
  198. status = response.get('status', None)
  199. if status is None or status == ErrorCode.SUCCESS:
  200. return
  201. value = None
  202. message = response.get("message", "")
  203. screen = response.get("screen", "")
  204. stacktrace = None
  205. if isinstance(status, int):
  206. value_json = response.get('value', None)
  207. if value_json and isinstance(value_json, basestring):
  208. import json
  209. try:
  210. value = json.loads(value_json)
  211. if len(value.keys()) == 1:
  212. value = value['value']
  213. status = value.get('error', None)
  214. if status is None:
  215. status = value["status"]
  216. message = value["value"]
  217. if not isinstance(message, basestring):
  218. value = message
  219. message = message.get('message')
  220. else:
  221. message = value.get('message', None)
  222. except ValueError:
  223. pass
  224.  
  225. exception_class = ErrorInResponseException
  226. if status in ErrorCode.NO_SUCH_ELEMENT:
  227. exception_class = NoSuchElementException
  228. elif status in ErrorCode.NO_SUCH_FRAME:
  229. exception_class = NoSuchFrameException
  230. elif status in ErrorCode.NO_SUCH_WINDOW:
  231. exception_class = NoSuchWindowException
  232. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  233. exception_class = StaleElementReferenceException
  234. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  235. exception_class = ElementNotVisibleException
  236. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  237. exception_class = InvalidElementStateException
  238. elif status in ErrorCode.INVALID_SELECTOR \
  239. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  240. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  241. exception_class = InvalidSelectorException
  242. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  243. exception_class = ElementNotSelectableException
  244. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  245. exception_class = ElementNotInteractableException
  246. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  247. exception_class = WebDriverException
  248. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  249. exception_class = WebDriverException
  250. elif status in ErrorCode.TIMEOUT:
  251. exception_class = TimeoutException
  252. elif status in ErrorCode.SCRIPT_TIMEOUT:
  253. exception_class = TimeoutException
  254. elif status in ErrorCode.UNKNOWN_ERROR:
  255. exception_class = WebDriverException
  256. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  257. exception_class = UnexpectedAlertPresentException
  258. elif status in ErrorCode.NO_ALERT_OPEN:
  259. exception_class = NoAlertPresentException
  260. elif status in ErrorCode.IME_NOT_AVAILABLE:
  261. exception_class = ImeNotAvailableException
  262. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  263. exception_class = ImeActivationFailedException
  264. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  265. exception_class = MoveTargetOutOfBoundsException
  266. else:
  267. exception_class = WebDriverException
  268. if value == '' or value is None:
  269. value = response['value']
  270. if isinstance(value, basestring):
  271. if exception_class == ErrorInResponseException:
  272. raise exception_class(response, value)
  273. raise exception_class(value)
  274. if message == "" and 'message' in value:
  275. message = value['message']
  276.  
  277. screen = None
  278. if 'screen' in value:
  279. screen = value['screen']
  280.  
  281. stacktrace = None
  282. if 'stackTrace' in value and value['stackTrace']:
  283. stacktrace = []
  284. try:
  285. for frame in value['stackTrace']:
  286. line = self._value_or_default(frame, 'lineNumber', '')
  287. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  288. if line:
  289. file = "%s:%s" % (file, line)
  290. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  291. if 'className' in frame:
  292. meth = "%s.%s" % (frame['className'], meth)
  293. msg = " at %s (%s)"
  294. msg = msg % (meth, file)
  295. stacktrace.append(msg)
  296. except TypeError:
  297. pass
  298. if exception_class == ErrorInResponseException:
  299. raise exception_class(response, message)
  300. elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
  301. raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
  302. > raise exception_class(message, screen, stacktrace)
  303. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"name","selector":"selected[]"}
  304. E Stacktrace:
  305. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/driver-component.js:10484)
  306. E at FirefoxDriver.prototype.findChildElement (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/driver-component.js:10496)
  307. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/command-processor.js:13351)
  308. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/command-processor.js:13356)
  309. E at DelayedCommand.prototype.execute/< (file:///C:/Users/Mihail/AppData/Local/Temp/tmpw4zugn82/extensions/fxdriver@googlecode.com/components/command-processor.js:13298)
  310.  
  311. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:194: NoSuchElementException
  312. ========================== 1 failed in 18.35 seconds ==========================
  313. Process finished with exit code 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement