Guest User

Untitled

a guest
Nov 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.00 KB | None | 0 0
  1. Testing started at 23:05 ...
  2. D:\python_training_2\env\Scripts\python.exe "C:\Program Files\PyCharm\helpers\pycharm\_jb_pytest_runner.py" --path D:/python_training_2/test/test_del_contact.py
  3. Launching pytest with arguments D:/python_training_2/test/test_del_contact.py in D:\python_training_2\test
  4.  
  5. ============================= test session starts =============================
  6. platform win32 -- Python 3.7.1, pytest-3.10.0, py-1.7.0, pluggy-0.8.0
  7. rootdir: D:\python_training_2\test, inifile:collected 1 item
  8.  
  9. test_del_contact.py F
  10. test_del_contact.py:4 (test_del_contact)
  11. app = <fixture.application.Application object at 0x038A61F0>
  12.  
  13. def test_del_contact(app):
  14. app.open_home_page()
  15. > if app.contact.count() == 0:
  16.  
  17. test_del_contact.py:7:
  18. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  19. ..\fixture\contact.py:92: in count
  20. return len(wd.find_element_by_xpath("//img[@alt='Edit']"))
  21. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:394: in find_element_by_xpath
  22. return self.find_element(by=By.XPATH, value=xpath)
  23. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  24. 'value': value})['value']
  25. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  26. self.error_handler.check_response(response)
  27. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  28.  
  29. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x038A6490>
  30. response = {'sessionId': '54826cfe312a308b61fdeff3b2d9c1b9', 'status': 7, 'value': {'message': 'no such element: Unable to locate...ver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64)'}}
  31.  
  32. def check_response(self, response):
  33. """
  34. Checks that a JSON response from the WebDriver does not have an error.
  35.  
  36. :Args:
  37. - response - The JSON response from the WebDriver server as a dictionary
  38. object.
  39.  
  40. :Raises: If the response contains an error message.
  41. """
  42. status = response.get('status', None)
  43. if status is None or status == ErrorCode.SUCCESS:
  44. return
  45. value = None
  46. message = response.get("message", "")
  47. screen = response.get("screen", "")
  48. stacktrace = None
  49. if isinstance(status, int):
  50. value_json = response.get('value', None)
  51. if value_json and isinstance(value_json, basestring):
  52. import json
  53. try:
  54. value = json.loads(value_json)
  55. if len(value.keys()) == 1:
  56. value = value['value']
  57. status = value.get('error', None)
  58. if status is None:
  59. status = value["status"]
  60. message = value["value"]
  61. if not isinstance(message, basestring):
  62. value = message
  63. message = message.get('message')
  64. else:
  65. message = value.get('message', None)
  66. except ValueError:
  67. pass
  68.  
  69. exception_class = ErrorInResponseException
  70. if status in ErrorCode.NO_SUCH_ELEMENT:
  71. exception_class = NoSuchElementException
  72. elif status in ErrorCode.NO_SUCH_FRAME:
  73. exception_class = NoSuchFrameException
  74. elif status in ErrorCode.NO_SUCH_WINDOW:
  75. exception_class = NoSuchWindowException
  76. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  77. exception_class = StaleElementReferenceException
  78. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  79. exception_class = ElementNotVisibleException
  80. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  81. exception_class = InvalidElementStateException
  82. elif status in ErrorCode.INVALID_SELECTOR \
  83. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  84. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  85. exception_class = InvalidSelectorException
  86. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  87. exception_class = ElementNotSelectableException
  88. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  89. exception_class = ElementNotInteractableException
  90. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  91. exception_class = InvalidCookieDomainException
  92. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  93. exception_class = UnableToSetCookieException
  94. elif status in ErrorCode.TIMEOUT:
  95. exception_class = TimeoutException
  96. elif status in ErrorCode.SCRIPT_TIMEOUT:
  97. exception_class = TimeoutException
  98. elif status in ErrorCode.UNKNOWN_ERROR:
  99. exception_class = WebDriverException
  100. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  101. exception_class = UnexpectedAlertPresentException
  102. elif status in ErrorCode.NO_ALERT_OPEN:
  103. exception_class = NoAlertPresentException
  104. elif status in ErrorCode.IME_NOT_AVAILABLE:
  105. exception_class = ImeNotAvailableException
  106. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  107. exception_class = ImeActivationFailedException
  108. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  109. exception_class = MoveTargetOutOfBoundsException
  110. elif status in ErrorCode.JAVASCRIPT_ERROR:
  111. exception_class = JavascriptException
  112. elif status in ErrorCode.SESSION_NOT_CREATED:
  113. exception_class = SessionNotCreatedException
  114. elif status in ErrorCode.INVALID_ARGUMENT:
  115. exception_class = InvalidArgumentException
  116. elif status in ErrorCode.NO_SUCH_COOKIE:
  117. exception_class = NoSuchCookieException
  118. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  119. exception_class = ScreenshotException
  120. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  121. exception_class = ElementClickInterceptedException
  122. elif status in ErrorCode.INSECURE_CERTIFICATE:
  123. exception_class = InsecureCertificateException
  124. elif status in ErrorCode.INVALID_COORDINATES:
  125. exception_class = InvalidCoordinatesException
  126. elif status in ErrorCode.INVALID_SESSION_ID:
  127. exception_class = InvalidSessionIdException
  128. elif status in ErrorCode.UNKNOWN_METHOD:
  129. exception_class = UnknownMethodException
  130. else:
  131. exception_class = WebDriverException
  132. if value == '' or value is None:
  133. value = response['value']
  134. if isinstance(value, basestring):
  135. if exception_class == ErrorInResponseException:
  136. raise exception_class(response, value)
  137. raise exception_class(value)
  138. if message == "" and 'message' in value:
  139. message = value['message']
  140.  
  141. screen = None
  142. if 'screen' in value:
  143. screen = value['screen']
  144.  
  145. stacktrace = None
  146. if 'stackTrace' in value and value['stackTrace']:
  147. stacktrace = []
  148. try:
  149. for frame in value['stackTrace']:
  150. line = self._value_or_default(frame, 'lineNumber', '')
  151. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  152. if line:
  153. file = "%s:%s" % (file, line)
  154. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  155. if 'className' in frame:
  156. meth = "%s.%s" % (frame['className'], meth)
  157. msg = " at %s (%s)"
  158. msg = msg % (meth, file)
  159. stacktrace.append(msg)
  160. except TypeError:
  161. pass
  162. if exception_class == ErrorInResponseException:
  163. raise exception_class(response, message)
  164. elif exception_class == UnexpectedAlertPresentException:
  165. alert_text = None
  166. if 'data' in value:
  167. alert_text = value['data'].get('text')
  168. elif 'alert' in value:
  169. alert_text = value['alert'].get('text')
  170. raise exception_class(message, screen, stacktrace, alert_text)
  171. > raise exception_class(message, screen, stacktrace)
  172. E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//img[@alt='Edit']"}
  173. E (Session info: chrome=70.0.3538.102)
  174. E (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64)
  175.  
  176. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  177. [100%]
  178.  
  179. ================================== FAILURES ===================================
  180. ______________________________ test_del_contact _______________________________
  181.  
  182. app = <fixture.application.Application object at 0x038A61F0>
  183.  
  184. def test_del_contact(app):
  185. app.open_home_page()
  186. > if app.contact.count() == 0:
  187.  
  188. test_del_contact.py:7:
  189. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  190. ..\fixture\contact.py:92: in count
  191. return len(wd.find_element_by_xpath("//img[@alt='Edit']"))
  192. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:394: in find_element_by_xpath
  193. return self.find_element(by=By.XPATH, value=xpath)
  194. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  195. 'value': value})['value']
  196. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  197. self.error_handler.check_response(response)
  198. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  199.  
  200. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x038A6490>
  201. response = {'sessionId': '54826cfe312a308b61fdeff3b2d9c1b9', 'status': 7, 'value': {'message': 'no such element: Unable to locate...ver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64)'}}
  202.  
  203. def check_response(self, response):
  204. """
  205. Checks that a JSON response from the WebDriver does not have an error.
  206.  
  207. :Args:
  208. - response - The JSON response from the WebDriver server as a dictionary
  209. object.
  210.  
  211. :Raises: If the response contains an error message.
  212. """
  213. status = response.get('status', None)
  214. if status is None or status == ErrorCode.SUCCESS:
  215. return
  216. value = None
  217. message = response.get("message", "")
  218. screen = response.get("screen", "")
  219. stacktrace = None
  220. if isinstance(status, int):
  221. value_json = response.get('value', None)
  222. if value_json and isinstance(value_json, basestring):
  223. import json
  224. try:
  225. value = json.loads(value_json)
  226. if len(value.keys()) == 1:
  227. value = value['value']
  228. status = value.get('error', None)
  229. if status is None:
  230. status = value["status"]
  231. message = value["value"]
  232. if not isinstance(message, basestring):
  233. value = message
  234. message = message.get('message')
  235. else:
  236. message = value.get('message', None)
  237. except ValueError:
  238. pass
  239.  
  240. exception_class = ErrorInResponseException
  241. if status in ErrorCode.NO_SUCH_ELEMENT:
  242. exception_class = NoSuchElementException
  243. elif status in ErrorCode.NO_SUCH_FRAME:
  244. exception_class = NoSuchFrameException
  245. elif status in ErrorCode.NO_SUCH_WINDOW:
  246. exception_class = NoSuchWindowException
  247. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  248. exception_class = StaleElementReferenceException
  249. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  250. exception_class = ElementNotVisibleException
  251. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  252. exception_class = InvalidElementStateException
  253. elif status in ErrorCode.INVALID_SELECTOR \
  254. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  255. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  256. exception_class = InvalidSelectorException
  257. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  258. exception_class = ElementNotSelectableException
  259. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  260. exception_class = ElementNotInteractableException
  261. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  262. exception_class = InvalidCookieDomainException
  263. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  264. exception_class = UnableToSetCookieException
  265. elif status in ErrorCode.TIMEOUT:
  266. exception_class = TimeoutException
  267. elif status in ErrorCode.SCRIPT_TIMEOUT:
  268. exception_class = TimeoutException
  269. elif status in ErrorCode.UNKNOWN_ERROR:
  270. exception_class = WebDriverException
  271. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  272. exception_class = UnexpectedAlertPresentException
  273. elif status in ErrorCode.NO_ALERT_OPEN:
  274. exception_class = NoAlertPresentException
  275. elif status in ErrorCode.IME_NOT_AVAILABLE:
  276. exception_class = ImeNotAvailableException
  277. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  278. exception_class = ImeActivationFailedException
  279. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  280. exception_class = MoveTargetOutOfBoundsException
  281. elif status in ErrorCode.JAVASCRIPT_ERROR:
  282. exception_class = JavascriptException
  283. elif status in ErrorCode.SESSION_NOT_CREATED:
  284. exception_class = SessionNotCreatedException
  285. elif status in ErrorCode.INVALID_ARGUMENT:
  286. exception_class = InvalidArgumentException
  287. elif status in ErrorCode.NO_SUCH_COOKIE:
  288. exception_class = NoSuchCookieException
  289. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  290. exception_class = ScreenshotException
  291. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  292. exception_class = ElementClickInterceptedException
  293. elif status in ErrorCode.INSECURE_CERTIFICATE:
  294. exception_class = InsecureCertificateException
  295. elif status in ErrorCode.INVALID_COORDINATES:
  296. exception_class = InvalidCoordinatesException
  297. elif status in ErrorCode.INVALID_SESSION_ID:
  298. exception_class = InvalidSessionIdException
  299. elif status in ErrorCode.UNKNOWN_METHOD:
  300. exception_class = UnknownMethodException
  301. else:
  302. exception_class = WebDriverException
  303. if value == '' or value is None:
  304. value = response['value']
  305. if isinstance(value, basestring):
  306. if exception_class == ErrorInResponseException:
  307. raise exception_class(response, value)
  308. raise exception_class(value)
  309. if message == "" and 'message' in value:
  310. message = value['message']
  311.  
  312. screen = None
  313. if 'screen' in value:
  314. screen = value['screen']
  315.  
  316. stacktrace = None
  317. if 'stackTrace' in value and value['stackTrace']:
  318. stacktrace = []
  319. try:
  320. for frame in value['stackTrace']:
  321. line = self._value_or_default(frame, 'lineNumber', '')
  322. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  323. if line:
  324. file = "%s:%s" % (file, line)
  325. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  326. if 'className' in frame:
  327. meth = "%s.%s" % (frame['className'], meth)
  328. msg = " at %s (%s)"
  329. msg = msg % (meth, file)
  330. stacktrace.append(msg)
  331. except TypeError:
  332. pass
  333. if exception_class == ErrorInResponseException:
  334. raise exception_class(response, message)
  335. elif exception_class == UnexpectedAlertPresentException:
  336. alert_text = None
  337. if 'data' in value:
  338. alert_text = value['data'].get('text')
  339. elif 'alert' in value:
  340. alert_text = value['alert'].get('text')
  341. raise exception_class(message, screen, stacktrace, alert_text)
  342. > raise exception_class(message, screen, stacktrace)
  343. E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//img[@alt='Edit']"}
  344. E (Session info: chrome=70.0.3538.102)
  345. E (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64)
  346.  
  347. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  348. ========================== 1 failed in 6.50 seconds ===========================
  349. Process finished with exit code 0
Add Comment
Please, Sign In to add comment