Guest User

Untitled

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