Guest User

Untitled

a guest
Jun 14th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.81 KB | None | 0 0
  1. Testing started at 16:09 ...
  2. C:\Devel\python_training\env\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.3\helpers\pycharm\_jb_pytest_runner.py" --path C:/Devel/python_training/test/test_add_contact.py
  3. Launching py.test with arguments C:/Devel/python_training/test/test_add_contact.py in C:\Devel\python_training\test
  4.  
  5. ============================= test session starts =============================
  6. platform win32 -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
  7. rootdir: C:\Devel\python_training\test, inifile:collected 1 item
  8.  
  9. test_add_contact.py F
  10. test_add_contact.py:4 (test_add_contact)
  11. app = <fixture.application.Application object at 0x03A97C30>
  12.  
  13. def test_add_contact(app):
  14. > old_contacts = app.contact.get_contact_list()
  15.  
  16. test_add_contact.py:6:
  17. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  18. ..\fixture\contact.py:68: in get_contact_list
  19. name = element.find_element_by_name("firstname").text
  20. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:209: 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:653: in find_element
  23. {"using": by, "value": value})['value']
  24. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:628: in _execute
  25. return self._parent.execute(command, params)
  26. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:314: in execute
  27. self.error_handler.check_response(response)
  28. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  29.  
  30. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x03A9E430>
  31. response = {'status': 500, 'value': '{"name":"findChildElement","sessionId":"348a8a91-2c1f-4aef-90d3-a81d2702d660","status":7,"va...pin1jclbv/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13335,"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 = InvalidCookieDomainException
  93. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  94. exception_class = UnableToSetCookieException
  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. elif status in ErrorCode.JAVASCRIPT_ERROR:
  112. exception_class = JavascriptException
  113. elif status in ErrorCode.SESSION_NOT_CREATED:
  114. exception_class = SessionNotCreatedException
  115. elif status in ErrorCode.INVALID_ARGUMENT:
  116. exception_class = InvalidArgumentException
  117. elif status in ErrorCode.NO_SUCH_COOKIE:
  118. exception_class = NoSuchCookieException
  119. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  120. exception_class = ScreenshotException
  121. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  122. exception_class = ElementClickInterceptedException
  123. elif status in ErrorCode.INSECURE_CERTIFICATE:
  124. exception_class = InsecureCertificateException
  125. elif status in ErrorCode.INVALID_COORDINATES:
  126. exception_class = InvalidCoordinatesException
  127. elif status in ErrorCode.INVALID_SESSION_ID:
  128. exception_class = InvalidSessionIdException
  129. elif status in ErrorCode.UNKNOWN_METHOD:
  130. exception_class = UnknownMethodException
  131. else:
  132. exception_class = WebDriverException
  133. if value == '' or value is None:
  134. value = response['value']
  135. if isinstance(value, basestring):
  136. if exception_class == ErrorInResponseException:
  137. raise exception_class(response, value)
  138. raise exception_class(value)
  139. if message == "" and 'message' in value:
  140. message = value['message']
  141.  
  142. screen = None
  143. if 'screen' in value:
  144. screen = value['screen']
  145.  
  146. stacktrace = None
  147. if 'stackTrace' in value and value['stackTrace']:
  148. stacktrace = []
  149. try:
  150. for frame in value['stackTrace']:
  151. line = self._value_or_default(frame, 'lineNumber', '')
  152. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  153. if line:
  154. file = "%s:%s" % (file, line)
  155. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  156. if 'className' in frame:
  157. meth = "%s.%s" % (frame['className'], meth)
  158. msg = " at %s (%s)"
  159. msg = msg % (meth, file)
  160. stacktrace.append(msg)
  161. except TypeError:
  162. pass
  163. if exception_class == ErrorInResponseException:
  164. raise exception_class(response, message)
  165. elif exception_class == UnexpectedAlertPresentException:
  166. alert_text = None
  167. if 'data' in value:
  168. alert_text = value['data'].get('text')
  169. elif 'alert' in value:
  170. alert_text = value['alert'].get('text')
  171. raise exception_class(message, screen, stacktrace, alert_text)
  172. > raise exception_class(message, screen, stacktrace)
  173. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"name","selector":"firstname"}
  174. E Stacktrace:
  175. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/driver-component.js:11878)
  176. E at FirefoxDriver.prototype.findChildElement (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/driver-component.js:11890)
  177. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/command-processor.js:13388)
  178. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/command-processor.js:13393)
  179. E at DelayedCommand.prototype.execute/< (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/command-processor.js:13335)
  180.  
  181. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  182. [100%]
  183.  
  184. ================================== FAILURES ===================================
  185. ______________________________ test_add_contact _______________________________
  186.  
  187. app = <fixture.application.Application object at 0x03A97C30>
  188.  
  189. def test_add_contact(app):
  190. > old_contacts = app.contact.get_contact_list()
  191.  
  192. test_add_contact.py:6:
  193. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  194. ..\fixture\contact.py:68: in get_contact_list
  195. name = element.find_element_by_name("firstname").text
  196. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:209: in find_element_by_name
  197. return self.find_element(by=By.NAME, value=name)
  198. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:653: in find_element
  199. {"using": by, "value": value})['value']
  200. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:628: in _execute
  201. return self._parent.execute(command, params)
  202. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:314: in execute
  203. self.error_handler.check_response(response)
  204. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  205.  
  206. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x03A9E430>
  207. response = {'status': 500, 'value': '{"name":"findChildElement","sessionId":"348a8a91-2c1f-4aef-90d3-a81d2702d660","status":7,"va...pin1jclbv/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13335,"columnNumber":5}]}}'}
  208.  
  209. def check_response(self, response):
  210. """
  211. Checks that a JSON response from the WebDriver does not have an error.
  212.  
  213. :Args:
  214. - response - The JSON response from the WebDriver server as a dictionary
  215. object.
  216.  
  217. :Raises: If the response contains an error message.
  218. """
  219. status = response.get('status', None)
  220. if status is None or status == ErrorCode.SUCCESS:
  221. return
  222. value = None
  223. message = response.get("message", "")
  224. screen = response.get("screen", "")
  225. stacktrace = None
  226. if isinstance(status, int):
  227. value_json = response.get('value', None)
  228. if value_json and isinstance(value_json, basestring):
  229. import json
  230. try:
  231. value = json.loads(value_json)
  232. if len(value.keys()) == 1:
  233. value = value['value']
  234. status = value.get('error', None)
  235. if status is None:
  236. status = value["status"]
  237. message = value["value"]
  238. if not isinstance(message, basestring):
  239. value = message
  240. message = message.get('message')
  241. else:
  242. message = value.get('message', None)
  243. except ValueError:
  244. pass
  245.  
  246. exception_class = ErrorInResponseException
  247. if status in ErrorCode.NO_SUCH_ELEMENT:
  248. exception_class = NoSuchElementException
  249. elif status in ErrorCode.NO_SUCH_FRAME:
  250. exception_class = NoSuchFrameException
  251. elif status in ErrorCode.NO_SUCH_WINDOW:
  252. exception_class = NoSuchWindowException
  253. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  254. exception_class = StaleElementReferenceException
  255. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  256. exception_class = ElementNotVisibleException
  257. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  258. exception_class = InvalidElementStateException
  259. elif status in ErrorCode.INVALID_SELECTOR \
  260. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  261. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  262. exception_class = InvalidSelectorException
  263. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  264. exception_class = ElementNotSelectableException
  265. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  266. exception_class = ElementNotInteractableException
  267. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  268. exception_class = InvalidCookieDomainException
  269. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  270. exception_class = UnableToSetCookieException
  271. elif status in ErrorCode.TIMEOUT:
  272. exception_class = TimeoutException
  273. elif status in ErrorCode.SCRIPT_TIMEOUT:
  274. exception_class = TimeoutException
  275. elif status in ErrorCode.UNKNOWN_ERROR:
  276. exception_class = WebDriverException
  277. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  278. exception_class = UnexpectedAlertPresentException
  279. elif status in ErrorCode.NO_ALERT_OPEN:
  280. exception_class = NoAlertPresentException
  281. elif status in ErrorCode.IME_NOT_AVAILABLE:
  282. exception_class = ImeNotAvailableException
  283. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  284. exception_class = ImeActivationFailedException
  285. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  286. exception_class = MoveTargetOutOfBoundsException
  287. elif status in ErrorCode.JAVASCRIPT_ERROR:
  288. exception_class = JavascriptException
  289. elif status in ErrorCode.SESSION_NOT_CREATED:
  290. exception_class = SessionNotCreatedException
  291. elif status in ErrorCode.INVALID_ARGUMENT:
  292. exception_class = InvalidArgumentException
  293. elif status in ErrorCode.NO_SUCH_COOKIE:
  294. exception_class = NoSuchCookieException
  295. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  296. exception_class = ScreenshotException
  297. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  298. exception_class = ElementClickInterceptedException
  299. elif status in ErrorCode.INSECURE_CERTIFICATE:
  300. exception_class = InsecureCertificateException
  301. elif status in ErrorCode.INVALID_COORDINATES:
  302. exception_class = InvalidCoordinatesException
  303. elif status in ErrorCode.INVALID_SESSION_ID:
  304. exception_class = InvalidSessionIdException
  305. elif status in ErrorCode.UNKNOWN_METHOD:
  306. exception_class = UnknownMethodException
  307. else:
  308. exception_class = WebDriverException
  309. if value == '' or value is None:
  310. value = response['value']
  311. if isinstance(value, basestring):
  312. if exception_class == ErrorInResponseException:
  313. raise exception_class(response, value)
  314. raise exception_class(value)
  315. if message == "" and 'message' in value:
  316. message = value['message']
  317.  
  318. screen = None
  319. if 'screen' in value:
  320. screen = value['screen']
  321.  
  322. stacktrace = None
  323. if 'stackTrace' in value and value['stackTrace']:
  324. stacktrace = []
  325. try:
  326. for frame in value['stackTrace']:
  327. line = self._value_or_default(frame, 'lineNumber', '')
  328. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  329. if line:
  330. file = "%s:%s" % (file, line)
  331. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  332. if 'className' in frame:
  333. meth = "%s.%s" % (frame['className'], meth)
  334. msg = " at %s (%s)"
  335. msg = msg % (meth, file)
  336. stacktrace.append(msg)
  337. except TypeError:
  338. pass
  339. if exception_class == ErrorInResponseException:
  340. raise exception_class(response, message)
  341. elif exception_class == UnexpectedAlertPresentException:
  342. alert_text = None
  343. if 'data' in value:
  344. alert_text = value['data'].get('text')
  345. elif 'alert' in value:
  346. alert_text = value['alert'].get('text')
  347. raise exception_class(message, screen, stacktrace, alert_text)
  348. > raise exception_class(message, screen, stacktrace)
  349. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"name","selector":"firstname"}
  350. E Stacktrace:
  351. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/driver-component.js:11878)
  352. E at FirefoxDriver.prototype.findChildElement (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/driver-component.js:11890)
  353. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/command-processor.js:13388)
  354. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/command-processor.js:13393)
  355. E at DelayedCommand.prototype.execute/< (file:///C:/Users/user/AppData/Local/Temp/tmpin1jclbv/extensions/fxdriver@googlecode.com/components/command-processor.js:13335)
  356.  
  357. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  358. ========================== 1 failed in 12.28 seconds ==========================
  359. Process finished with exit code 0
Add Comment
Please, Sign In to add comment