Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.96 KB | None | 0 0
  1. Testing started at 23:40 ...
  2. C:\python_training\env\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.2\helpers\pycharm\_jb_pytest_runner.py" --path C:/python_training/test
  3. Launching pytest with arguments C:/python_training/test in C:\python_training\test
  4.  
  5. ============================= test session starts =============================
  6. platform win32 -- Python 3.7.3, pytest-5.1.2, py-1.8.0, pluggy-0.13.0 -- C:\python_training\env\Scripts\python.exe
  7. cachedir: .pytest_cache
  8. rootdir: C:\python_training\test
  9. collecting ... collected 10 items
  10.  
  11. test_add_contact.py::test_add_contact PASSED [ 10%]
  12. test_add_group.py::test_add_group PASSED [ 20%]
  13. test_add_group.py::test_add_empty_group PASSED [ 30%]
  14. test_del_contact.py::test_delete_contact FAILED [ 40%]
  15. test_del_contact.py:1 (test_delete_contact)
  16. app = <fixture.application.Application object at 0x0000000003EB3438>
  17.  
  18. def test_delete_contact(app):
  19. > app.contact.delete_first_contact()
  20.  
  21. test_del_contact.py:3:
  22. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  23. ..\fixture\contact.py:70: in delete_first_contact
  24. wd.find_element_by_xpath("//input[@value='Delete']").click()
  25. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:394: in find_element_by_xpath
  26. return self.find_element(by=By.XPATH, value=xpath)
  27. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  28. 'value': value})['value']
  29. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  30. self.error_handler.check_response(response)
  31. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  32.  
  33. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0000000003EB3E80>
  34. response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: //input[@value=\'De...ror@chrome://marionette/content/error.js:387:5\\nelement.find/</<@chrome://marionette/content/element.js:343:16\\n"}}'}
  35.  
  36. def check_response(self, response):
  37. """
  38. Checks that a JSON response from the WebDriver does not have an error.
  39.  
  40. :Args:
  41. - response - The JSON response from the WebDriver server as a dictionary
  42. object.
  43.  
  44. :Raises: If the response contains an error message.
  45. """
  46. status = response.get('status', None)
  47. if status is None or status == ErrorCode.SUCCESS:
  48. return
  49. value = None
  50. message = response.get("message", "")
  51. screen = response.get("screen", "")
  52. stacktrace = None
  53. if isinstance(status, int):
  54. value_json = response.get('value', None)
  55. if value_json and isinstance(value_json, basestring):
  56. import json
  57. try:
  58. value = json.loads(value_json)
  59. if len(value.keys()) == 1:
  60. value = value['value']
  61. status = value.get('error', None)
  62. if status is None:
  63. status = value["status"]
  64. message = value["value"]
  65. if not isinstance(message, basestring):
  66. value = message
  67. message = message.get('message')
  68. else:
  69. message = value.get('message', None)
  70. except ValueError:
  71. pass
  72.  
  73. exception_class = ErrorInResponseException
  74. if status in ErrorCode.NO_SUCH_ELEMENT:
  75. exception_class = NoSuchElementException
  76. elif status in ErrorCode.NO_SUCH_FRAME:
  77. exception_class = NoSuchFrameException
  78. elif status in ErrorCode.NO_SUCH_WINDOW:
  79. exception_class = NoSuchWindowException
  80. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  81. exception_class = StaleElementReferenceException
  82. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  83. exception_class = ElementNotVisibleException
  84. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  85. exception_class = InvalidElementStateException
  86. elif status in ErrorCode.INVALID_SELECTOR \
  87. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  88. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  89. exception_class = InvalidSelectorException
  90. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  91. exception_class = ElementNotSelectableException
  92. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  93. exception_class = ElementNotInteractableException
  94. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  95. exception_class = InvalidCookieDomainException
  96. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  97. exception_class = UnableToSetCookieException
  98. elif status in ErrorCode.TIMEOUT:
  99. exception_class = TimeoutException
  100. elif status in ErrorCode.SCRIPT_TIMEOUT:
  101. exception_class = TimeoutException
  102. elif status in ErrorCode.UNKNOWN_ERROR:
  103. exception_class = WebDriverException
  104. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  105. exception_class = UnexpectedAlertPresentException
  106. elif status in ErrorCode.NO_ALERT_OPEN:
  107. exception_class = NoAlertPresentException
  108. elif status in ErrorCode.IME_NOT_AVAILABLE:
  109. exception_class = ImeNotAvailableException
  110. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  111. exception_class = ImeActivationFailedException
  112. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  113. exception_class = MoveTargetOutOfBoundsException
  114. elif status in ErrorCode.JAVASCRIPT_ERROR:
  115. exception_class = JavascriptException
  116. elif status in ErrorCode.SESSION_NOT_CREATED:
  117. exception_class = SessionNotCreatedException
  118. elif status in ErrorCode.INVALID_ARGUMENT:
  119. exception_class = InvalidArgumentException
  120. elif status in ErrorCode.NO_SUCH_COOKIE:
  121. exception_class = NoSuchCookieException
  122. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  123. exception_class = ScreenshotException
  124. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  125. exception_class = ElementClickInterceptedException
  126. elif status in ErrorCode.INSECURE_CERTIFICATE:
  127. exception_class = InsecureCertificateException
  128. elif status in ErrorCode.INVALID_COORDINATES:
  129. exception_class = InvalidCoordinatesException
  130. elif status in ErrorCode.INVALID_SESSION_ID:
  131. exception_class = InvalidSessionIdException
  132. elif status in ErrorCode.UNKNOWN_METHOD:
  133. exception_class = UnknownMethodException
  134. else:
  135. exception_class = WebDriverException
  136. if value == '' or value is None:
  137. value = response['value']
  138. if isinstance(value, basestring):
  139. if exception_class == ErrorInResponseException:
  140. raise exception_class(response, value)
  141. raise exception_class(value)
  142. if message == "" and 'message' in value:
  143. message = value['message']
  144.  
  145. screen = None
  146. if 'screen' in value:
  147. screen = value['screen']
  148.  
  149. stacktrace = None
  150. if 'stackTrace' in value and value['stackTrace']:
  151. stacktrace = []
  152. try:
  153. for frame in value['stackTrace']:
  154. line = self._value_or_default(frame, 'lineNumber', '')
  155. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  156. if line:
  157. file = "%s:%s" % (file, line)
  158. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  159. if 'className' in frame:
  160. meth = "%s.%s" % (frame['className'], meth)
  161. msg = " at %s (%s)"
  162. msg = msg % (meth, file)
  163. stacktrace.append(msg)
  164. except TypeError:
  165. pass
  166. if exception_class == ErrorInResponseException:
  167. raise exception_class(response, message)
  168. elif exception_class == UnexpectedAlertPresentException:
  169. alert_text = None
  170. if 'data' in value:
  171. alert_text = value['data'].get('text')
  172. elif 'alert' in value:
  173. alert_text = value['alert'].get('text')
  174. raise exception_class(message, screen, stacktrace, alert_text)
  175. > raise exception_class(message, screen, stacktrace)
  176. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //input[@value='Delete']
  177.  
  178. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  179.  
  180. test_del_group.py::test_delete_first_group
  181. Assertion failed
  182.  
  183. Assertion failed
  184. PASSED [ 50%]
  185. test_modify_contact.py::test_modify_contact FAILED [ 60%]
  186. test_modify_contact.py:3 (test_modify_contact)
  187. app = <fixture.application.Application object at 0x0000000003EB3438>
  188.  
  189. def test_modify_contact(app):
  190. app.contact.modify(Contact(firstname="1", middlename="2", lastname="3", nickname="4", company="4",
  191. company_address="5", home_number="6", mobile_number="7", work_number="8", fax_number="9", email="1",
  192. email2="2", email3="3", homepage="4", bday="5", bmonth="April", byear="1920", aday="5",
  193. > amonth="April", ayear="1950", address2="1", homephone="1", notes="1"))
  194.  
  195. test_modify_contact.py:8:
  196. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  197. ..\fixture\contact.py:21: in modify
  198. wd.find_element_by_xpath("//img[@alt='Edit']").click()
  199. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:394: in find_element_by_xpath
  200. return self.find_element(by=By.XPATH, value=xpath)
  201. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  202. 'value': value})['value']
  203. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  204. self.error_handler.check_response(response)
  205. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  206.  
  207. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0000000003EB3E80>
  208. response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: //img[@alt=\'Edit\'...ror@chrome://marionette/content/error.js:387:5\\nelement.find/</<@chrome://marionette/content/element.js:343:16\\n"}}'}
  209.  
  210. def check_response(self, response):
  211. """
  212. Checks that a JSON response from the WebDriver does not have an error.
  213.  
  214. :Args:
  215. - response - The JSON response from the WebDriver server as a dictionary
  216. object.
  217.  
  218. :Raises: If the response contains an error message.
  219. """
  220. status = response.get('status', None)
  221. if status is None or status == ErrorCode.SUCCESS:
  222. return
  223. value = None
  224. message = response.get("message", "")
  225. screen = response.get("screen", "")
  226. stacktrace = None
  227. if isinstance(status, int):
  228. value_json = response.get('value', None)
  229. if value_json and isinstance(value_json, basestring):
  230. import json
  231. try:
  232. value = json.loads(value_json)
  233. if len(value.keys()) == 1:
  234. value = value['value']
  235. status = value.get('error', None)
  236. if status is None:
  237. status = value["status"]
  238. message = value["value"]
  239. if not isinstance(message, basestring):
  240. value = message
  241. message = message.get('message')
  242. else:
  243. message = value.get('message', None)
  244. except ValueError:
  245. pass
  246.  
  247. exception_class = ErrorInResponseException
  248. if status in ErrorCode.NO_SUCH_ELEMENT:
  249. exception_class = NoSuchElementException
  250. elif status in ErrorCode.NO_SUCH_FRAME:
  251. exception_class = NoSuchFrameException
  252. elif status in ErrorCode.NO_SUCH_WINDOW:
  253. exception_class = NoSuchWindowException
  254. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  255. exception_class = StaleElementReferenceException
  256. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  257. exception_class = ElementNotVisibleException
  258. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  259. exception_class = InvalidElementStateException
  260. elif status in ErrorCode.INVALID_SELECTOR \
  261. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  262. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  263. exception_class = InvalidSelectorException
  264. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  265. exception_class = ElementNotSelectableException
  266. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  267. exception_class = ElementNotInteractableException
  268. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  269. exception_class = InvalidCookieDomainException
  270. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  271. exception_class = UnableToSetCookieException
  272. elif status in ErrorCode.TIMEOUT:
  273. exception_class = TimeoutException
  274. elif status in ErrorCode.SCRIPT_TIMEOUT:
  275. exception_class = TimeoutException
  276. elif status in ErrorCode.UNKNOWN_ERROR:
  277. exception_class = WebDriverException
  278. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  279. exception_class = UnexpectedAlertPresentException
  280. elif status in ErrorCode.NO_ALERT_OPEN:
  281. exception_class = NoAlertPresentException
  282. elif status in ErrorCode.IME_NOT_AVAILABLE:
  283. exception_class = ImeNotAvailableException
  284. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  285. exception_class = ImeActivationFailedException
  286. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  287. exception_class = MoveTargetOutOfBoundsException
  288. elif status in ErrorCode.JAVASCRIPT_ERROR:
  289. exception_class = JavascriptException
  290. elif status in ErrorCode.SESSION_NOT_CREATED:
  291. exception_class = SessionNotCreatedException
  292. elif status in ErrorCode.INVALID_ARGUMENT:
  293. exception_class = InvalidArgumentException
  294. elif status in ErrorCode.NO_SUCH_COOKIE:
  295. exception_class = NoSuchCookieException
  296. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  297. exception_class = ScreenshotException
  298. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  299. exception_class = ElementClickInterceptedException
  300. elif status in ErrorCode.INSECURE_CERTIFICATE:
  301. exception_class = InsecureCertificateException
  302. elif status in ErrorCode.INVALID_COORDINATES:
  303. exception_class = InvalidCoordinatesException
  304. elif status in ErrorCode.INVALID_SESSION_ID:
  305. exception_class = InvalidSessionIdException
  306. elif status in ErrorCode.UNKNOWN_METHOD:
  307. exception_class = UnknownMethodException
  308. else:
  309. exception_class = WebDriverException
  310. if value == '' or value is None:
  311. value = response['value']
  312. if isinstance(value, basestring):
  313. if exception_class == ErrorInResponseException:
  314. raise exception_class(response, value)
  315. raise exception_class(value)
  316. if message == "" and 'message' in value:
  317. message = value['message']
  318.  
  319. screen = None
  320. if 'screen' in value:
  321. screen = value['screen']
  322.  
  323. stacktrace = None
  324. if 'stackTrace' in value and value['stackTrace']:
  325. stacktrace = []
  326. try:
  327. for frame in value['stackTrace']:
  328. line = self._value_or_default(frame, 'lineNumber', '')
  329. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  330. if line:
  331. file = "%s:%s" % (file, line)
  332. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  333. if 'className' in frame:
  334. meth = "%s.%s" % (frame['className'], meth)
  335. msg = " at %s (%s)"
  336. msg = msg % (meth, file)
  337. stacktrace.append(msg)
  338. except TypeError:
  339. pass
  340. if exception_class == ErrorInResponseException:
  341. raise exception_class(response, message)
  342. elif exception_class == UnexpectedAlertPresentException:
  343. alert_text = None
  344. if 'data' in value:
  345. alert_text = value['data'].get('text')
  346. elif 'alert' in value:
  347. alert_text = value['alert'].get('text')
  348. raise exception_class(message, screen, stacktrace, alert_text)
  349. > raise exception_class(message, screen, stacktrace)
  350. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //img[@alt='Edit']
  351.  
  352. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  353.  
  354. test_modify_contact.py::test_modify_contact_firstname FAILED [ 70%]
  355. test_modify_contact.py:10 (test_modify_contact_firstname)
  356. app = <fixture.application.Application object at 0x0000000003EB3438>
  357.  
  358. def test_modify_contact_firstname(app):
  359. > app.contact.modify(Contact(firstname="New name"))
  360.  
  361. test_modify_contact.py:12:
  362. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  363. ..\fixture\contact.py:21: in modify
  364. wd.find_element_by_xpath("//img[@alt='Edit']").click()
  365. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:394: in find_element_by_xpath
  366. return self.find_element(by=By.XPATH, value=xpath)
  367. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  368. 'value': value})['value']
  369. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  370. self.error_handler.check_response(response)
  371. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  372.  
  373. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0000000003EB3E80>
  374. response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: //img[@alt=\'Edit\'...ror@chrome://marionette/content/error.js:387:5\\nelement.find/</<@chrome://marionette/content/element.js:343:16\\n"}}'}
  375.  
  376. def check_response(self, response):
  377. """
  378. Checks that a JSON response from the WebDriver does not have an error.
  379.  
  380. :Args:
  381. - response - The JSON response from the WebDriver server as a dictionary
  382. object.
  383.  
  384. :Raises: If the response contains an error message.
  385. """
  386. status = response.get('status', None)
  387. if status is None or status == ErrorCode.SUCCESS:
  388. return
  389. value = None
  390. message = response.get("message", "")
  391. screen = response.get("screen", "")
  392. stacktrace = None
  393. if isinstance(status, int):
  394. value_json = response.get('value', None)
  395. if value_json and isinstance(value_json, basestring):
  396. import json
  397. try:
  398. value = json.loads(value_json)
  399. if len(value.keys()) == 1:
  400. value = value['value']
  401. status = value.get('error', None)
  402. if status is None:
  403. status = value["status"]
  404. message = value["value"]
  405. if not isinstance(message, basestring):
  406. value = message
  407. message = message.get('message')
  408. else:
  409. message = value.get('message', None)
  410. except ValueError:
  411. pass
  412.  
  413. exception_class = ErrorInResponseException
  414. if status in ErrorCode.NO_SUCH_ELEMENT:
  415. exception_class = NoSuchElementException
  416. elif status in ErrorCode.NO_SUCH_FRAME:
  417. exception_class = NoSuchFrameException
  418. elif status in ErrorCode.NO_SUCH_WINDOW:
  419. exception_class = NoSuchWindowException
  420. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  421. exception_class = StaleElementReferenceException
  422. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  423. exception_class = ElementNotVisibleException
  424. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  425. exception_class = InvalidElementStateException
  426. elif status in ErrorCode.INVALID_SELECTOR \
  427. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  428. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  429. exception_class = InvalidSelectorException
  430. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  431. exception_class = ElementNotSelectableException
  432. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  433. exception_class = ElementNotInteractableException
  434. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  435. exception_class = InvalidCookieDomainException
  436. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  437. exception_class = UnableToSetCookieException
  438. elif status in ErrorCode.TIMEOUT:
  439. exception_class = TimeoutException
  440. elif status in ErrorCode.SCRIPT_TIMEOUT:
  441. exception_class = TimeoutException
  442. elif status in ErrorCode.UNKNOWN_ERROR:
  443. exception_class = WebDriverException
  444. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  445. exception_class = UnexpectedAlertPresentException
  446. elif status in ErrorCode.NO_ALERT_OPEN:
  447. exception_class = NoAlertPresentException
  448. elif status in ErrorCode.IME_NOT_AVAILABLE:
  449. exception_class = ImeNotAvailableException
  450. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  451. exception_class = ImeActivationFailedException
  452. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  453. exception_class = MoveTargetOutOfBoundsException
  454. elif status in ErrorCode.JAVASCRIPT_ERROR:
  455. exception_class = JavascriptException
  456. elif status in ErrorCode.SESSION_NOT_CREATED:
  457. exception_class = SessionNotCreatedException
  458. elif status in ErrorCode.INVALID_ARGUMENT:
  459. exception_class = InvalidArgumentException
  460. elif status in ErrorCode.NO_SUCH_COOKIE:
  461. exception_class = NoSuchCookieException
  462. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  463. exception_class = ScreenshotException
  464. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  465. exception_class = ElementClickInterceptedException
  466. elif status in ErrorCode.INSECURE_CERTIFICATE:
  467. exception_class = InsecureCertificateException
  468. elif status in ErrorCode.INVALID_COORDINATES:
  469. exception_class = InvalidCoordinatesException
  470. elif status in ErrorCode.INVALID_SESSION_ID:
  471. exception_class = InvalidSessionIdException
  472. elif status in ErrorCode.UNKNOWN_METHOD:
  473. exception_class = UnknownMethodException
  474. else:
  475. exception_class = WebDriverException
  476. if value == '' or value is None:
  477. value = response['value']
  478. if isinstance(value, basestring):
  479. if exception_class == ErrorInResponseException:
  480. raise exception_class(response, value)
  481. raise exception_class(value)
  482. if message == "" and 'message' in value:
  483. message = value['message']
  484.  
  485. screen = None
  486. if 'screen' in value:
  487. screen = value['screen']
  488.  
  489. stacktrace = None
  490. if 'stackTrace' in value and value['stackTrace']:
  491. stacktrace = []
  492. try:
  493. for frame in value['stackTrace']:
  494. line = self._value_or_default(frame, 'lineNumber', '')
  495. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  496. if line:
  497. file = "%s:%s" % (file, line)
  498. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  499. if 'className' in frame:
  500. meth = "%s.%s" % (frame['className'], meth)
  501. msg = " at %s (%s)"
  502. msg = msg % (meth, file)
  503. stacktrace.append(msg)
  504. except TypeError:
  505. pass
  506. if exception_class == ErrorInResponseException:
  507. raise exception_class(response, message)
  508. elif exception_class == UnexpectedAlertPresentException:
  509. alert_text = None
  510. if 'data' in value:
  511. alert_text = value['data'].get('text')
  512. elif 'alert' in value:
  513. alert_text = value['alert'].get('text')
  514. raise exception_class(message, screen, stacktrace, alert_text)
  515. > raise exception_class(message, screen, stacktrace)
  516. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //img[@alt='Edit']
  517.  
  518. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  519.  
  520. test_modify_group.py::test_modify_group_name
  521. Assertion failed
  522.  
  523. Assertion failed
  524. PASSED [ 80%]
  525. test_modify_group.py::test_modify_group_header PASSED [ 90%]
  526. test_modify_group.py::test_modify_group_footer PASSED [100%]
  527.  
  528. ================================== FAILURES ===================================
  529. _____________________________ test_delete_contact _____________________________
  530.  
  531. app = <fixture.application.Application object at 0x0000000003EB3438>
  532.  
  533. def test_delete_contact(app):
  534. > app.contact.delete_first_contact()
  535.  
  536. test_del_contact.py:3:
  537. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  538. ..\fixture\contact.py:70: in delete_first_contact
  539. wd.find_element_by_xpath("//input[@value='Delete']").click()
  540. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:394: in find_element_by_xpath
  541. return self.find_element(by=By.XPATH, value=xpath)
  542. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  543. 'value': value})['value']
  544. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  545. self.error_handler.check_response(response)
  546. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  547.  
  548. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0000000003EB3E80>
  549. response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: //input[@value=\'De...ror@chrome://marionette/content/error.js:387:5\\nelement.find/</<@chrome://marionette/content/element.js:343:16\\n"}}'}
  550.  
  551. def check_response(self, response):
  552. """
  553. Checks that a JSON response from the WebDriver does not have an error.
  554.  
  555. :Args:
  556. - response - The JSON response from the WebDriver server as a dictionary
  557. object.
  558.  
  559. :Raises: If the response contains an error message.
  560. """
  561. status = response.get('status', None)
  562. if status is None or status == ErrorCode.SUCCESS:
  563. return
  564. value = None
  565. message = response.get("message", "")
  566. screen = response.get("screen", "")
  567. stacktrace = None
  568. if isinstance(status, int):
  569. value_json = response.get('value', None)
  570. if value_json and isinstance(value_json, basestring):
  571. import json
  572. try:
  573. value = json.loads(value_json)
  574. if len(value.keys()) == 1:
  575. value = value['value']
  576. status = value.get('error', None)
  577. if status is None:
  578. status = value["status"]
  579. message = value["value"]
  580. if not isinstance(message, basestring):
  581. value = message
  582. message = message.get('message')
  583. else:
  584. message = value.get('message', None)
  585. except ValueError:
  586. pass
  587.  
  588. exception_class = ErrorInResponseException
  589. if status in ErrorCode.NO_SUCH_ELEMENT:
  590. exception_class = NoSuchElementException
  591. elif status in ErrorCode.NO_SUCH_FRAME:
  592. exception_class = NoSuchFrameException
  593. elif status in ErrorCode.NO_SUCH_WINDOW:
  594. exception_class = NoSuchWindowException
  595. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  596. exception_class = StaleElementReferenceException
  597. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  598. exception_class = ElementNotVisibleException
  599. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  600. exception_class = InvalidElementStateException
  601. elif status in ErrorCode.INVALID_SELECTOR \
  602. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  603. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  604. exception_class = InvalidSelectorException
  605. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  606. exception_class = ElementNotSelectableException
  607. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  608. exception_class = ElementNotInteractableException
  609. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  610. exception_class = InvalidCookieDomainException
  611. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  612. exception_class = UnableToSetCookieException
  613. elif status in ErrorCode.TIMEOUT:
  614. exception_class = TimeoutException
  615. elif status in ErrorCode.SCRIPT_TIMEOUT:
  616. exception_class = TimeoutException
  617. elif status in ErrorCode.UNKNOWN_ERROR:
  618. exception_class = WebDriverException
  619. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  620. exception_class = UnexpectedAlertPresentException
  621. elif status in ErrorCode.NO_ALERT_OPEN:
  622. exception_class = NoAlertPresentException
  623. elif status in ErrorCode.IME_NOT_AVAILABLE:
  624. exception_class = ImeNotAvailableException
  625. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  626. exception_class = ImeActivationFailedException
  627. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  628. exception_class = MoveTargetOutOfBoundsException
  629. elif status in ErrorCode.JAVASCRIPT_ERROR:
  630. exception_class = JavascriptException
  631. elif status in ErrorCode.SESSION_NOT_CREATED:
  632. exception_class = SessionNotCreatedException
  633. elif status in ErrorCode.INVALID_ARGUMENT:
  634. exception_class = InvalidArgumentException
  635. elif status in ErrorCode.NO_SUCH_COOKIE:
  636. exception_class = NoSuchCookieException
  637. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  638. exception_class = ScreenshotException
  639. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  640. exception_class = ElementClickInterceptedException
  641. elif status in ErrorCode.INSECURE_CERTIFICATE:
  642. exception_class = InsecureCertificateException
  643. elif status in ErrorCode.INVALID_COORDINATES:
  644. exception_class = InvalidCoordinatesException
  645. elif status in ErrorCode.INVALID_SESSION_ID:
  646. exception_class = InvalidSessionIdException
  647. elif status in ErrorCode.UNKNOWN_METHOD:
  648. exception_class = UnknownMethodException
  649. else:
  650. exception_class = WebDriverException
  651. if value == '' or value is None:
  652. value = response['value']
  653. if isinstance(value, basestring):
  654. if exception_class == ErrorInResponseException:
  655. raise exception_class(response, value)
  656. raise exception_class(value)
  657. if message == "" and 'message' in value:
  658. message = value['message']
  659.  
  660. screen = None
  661. if 'screen' in value:
  662. screen = value['screen']
  663.  
  664. stacktrace = None
  665. if 'stackTrace' in value and value['stackTrace']:
  666. stacktrace = []
  667. try:
  668. for frame in value['stackTrace']:
  669. line = self._value_or_default(frame, 'lineNumber', '')
  670. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  671. if line:
  672. file = "%s:%s" % (file, line)
  673. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  674. if 'className' in frame:
  675. meth = "%s.%s" % (frame['className'], meth)
  676. msg = " at %s (%s)"
  677. msg = msg % (meth, file)
  678. stacktrace.append(msg)
  679. except TypeError:
  680. pass
  681. if exception_class == ErrorInResponseException:
  682. raise exception_class(response, message)
  683. elif exception_class == UnexpectedAlertPresentException:
  684. alert_text = None
  685. if 'data' in value:
  686. alert_text = value['data'].get('text')
  687. elif 'alert' in value:
  688. alert_text = value['alert'].get('text')
  689. raise exception_class(message, screen, stacktrace, alert_text)
  690. > raise exception_class(message, screen, stacktrace)
  691. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //input[@value='Delete']
  692.  
  693. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  694. _____________________________ test_modify_contact _____________________________
  695.  
  696. app = <fixture.application.Application object at 0x0000000003EB3438>
  697.  
  698. def test_modify_contact(app):
  699. app.contact.modify(Contact(firstname="1", middlename="2", lastname="3", nickname="4", company="4",
  700. company_address="5", home_number="6", mobile_number="7", work_number="8", fax_number="9", email="1",
  701. email2="2", email3="3", homepage="4", bday="5", bmonth="April", byear="1920", aday="5",
  702. > amonth="April", ayear="1950", address2="1", homephone="1", notes="1"))
  703.  
  704. test_modify_contact.py:8:
  705. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  706. ..\fixture\contact.py:21: in modify
  707. wd.find_element_by_xpath("//img[@alt='Edit']").click()
  708. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:394: in find_element_by_xpath
  709. return self.find_element(by=By.XPATH, value=xpath)
  710. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  711. 'value': value})['value']
  712. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  713. self.error_handler.check_response(response)
  714. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  715.  
  716. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0000000003EB3E80>
  717. response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: //img[@alt=\'Edit\'...ror@chrome://marionette/content/error.js:387:5\\nelement.find/</<@chrome://marionette/content/element.js:343:16\\n"}}'}
  718.  
  719. def check_response(self, response):
  720. """
  721. Checks that a JSON response from the WebDriver does not have an error.
  722.  
  723. :Args:
  724. - response - The JSON response from the WebDriver server as a dictionary
  725. object.
  726.  
  727. :Raises: If the response contains an error message.
  728. """
  729. status = response.get('status', None)
  730. if status is None or status == ErrorCode.SUCCESS:
  731. return
  732. value = None
  733. message = response.get("message", "")
  734. screen = response.get("screen", "")
  735. stacktrace = None
  736. if isinstance(status, int):
  737. value_json = response.get('value', None)
  738. if value_json and isinstance(value_json, basestring):
  739. import json
  740. try:
  741. value = json.loads(value_json)
  742. if len(value.keys()) == 1:
  743. value = value['value']
  744. status = value.get('error', None)
  745. if status is None:
  746. status = value["status"]
  747. message = value["value"]
  748. if not isinstance(message, basestring):
  749. value = message
  750. message = message.get('message')
  751. else:
  752. message = value.get('message', None)
  753. except ValueError:
  754. pass
  755.  
  756. exception_class = ErrorInResponseException
  757. if status in ErrorCode.NO_SUCH_ELEMENT:
  758. exception_class = NoSuchElementException
  759. elif status in ErrorCode.NO_SUCH_FRAME:
  760. exception_class = NoSuchFrameException
  761. elif status in ErrorCode.NO_SUCH_WINDOW:
  762. exception_class = NoSuchWindowException
  763. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  764. exception_class = StaleElementReferenceException
  765. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  766. exception_class = ElementNotVisibleException
  767. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  768. exception_class = InvalidElementStateException
  769. elif status in ErrorCode.INVALID_SELECTOR \
  770. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  771. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  772. exception_class = InvalidSelectorException
  773. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  774. exception_class = ElementNotSelectableException
  775. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  776. exception_class = ElementNotInteractableException
  777. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  778. exception_class = InvalidCookieDomainException
  779. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  780. exception_class = UnableToSetCookieException
  781. elif status in ErrorCode.TIMEOUT:
  782. exception_class = TimeoutException
  783. elif status in ErrorCode.SCRIPT_TIMEOUT:
  784. exception_class = TimeoutException
  785. elif status in ErrorCode.UNKNOWN_ERROR:
  786. exception_class = WebDriverException
  787. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  788. exception_class = UnexpectedAlertPresentException
  789. elif status in ErrorCode.NO_ALERT_OPEN:
  790. exception_class = NoAlertPresentException
  791. elif status in ErrorCode.IME_NOT_AVAILABLE:
  792. exception_class = ImeNotAvailableException
  793. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  794. exception_class = ImeActivationFailedException
  795. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  796. exception_class = MoveTargetOutOfBoundsException
  797. elif status in ErrorCode.JAVASCRIPT_ERROR:
  798. exception_class = JavascriptException
  799. elif status in ErrorCode.SESSION_NOT_CREATED:
  800. exception_class = SessionNotCreatedException
  801. elif status in ErrorCode.INVALID_ARGUMENT:
  802. exception_class = InvalidArgumentException
  803. elif status in ErrorCode.NO_SUCH_COOKIE:
  804. exception_class = NoSuchCookieException
  805. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  806. exception_class = ScreenshotException
  807. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  808. exception_class = ElementClickInterceptedException
  809. elif status in ErrorCode.INSECURE_CERTIFICATE:
  810. exception_class = InsecureCertificateException
  811. elif status in ErrorCode.INVALID_COORDINATES:
  812. exception_class = InvalidCoordinatesException
  813. elif status in ErrorCode.INVALID_SESSION_ID:
  814. exception_class = InvalidSessionIdException
  815. elif status in ErrorCode.UNKNOWN_METHOD:
  816. exception_class = UnknownMethodException
  817. else:
  818. exception_class = WebDriverException
  819. if value == '' or value is None:
  820. value = response['value']
  821. if isinstance(value, basestring):
  822. if exception_class == ErrorInResponseException:
  823. raise exception_class(response, value)
  824. raise exception_class(value)
  825. if message == "" and 'message' in value:
  826. message = value['message']
  827.  
  828. screen = None
  829. if 'screen' in value:
  830. screen = value['screen']
  831.  
  832. stacktrace = None
  833. if 'stackTrace' in value and value['stackTrace']:
  834. stacktrace = []
  835. try:
  836. for frame in value['stackTrace']:
  837. line = self._value_or_default(frame, 'lineNumber', '')
  838. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  839. if line:
  840. file = "%s:%s" % (file, line)
  841. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  842. if 'className' in frame:
  843. meth = "%s.%s" % (frame['className'], meth)
  844. msg = " at %s (%s)"
  845. msg = msg % (meth, file)
  846. stacktrace.append(msg)
  847. except TypeError:
  848. pass
  849. if exception_class == ErrorInResponseException:
  850. raise exception_class(response, message)
  851. elif exception_class == UnexpectedAlertPresentException:
  852. alert_text = None
  853. if 'data' in value:
  854. alert_text = value['data'].get('text')
  855. elif 'alert' in value:
  856. alert_text = value['alert'].get('text')
  857. raise exception_class(message, screen, stacktrace, alert_text)
  858. > raise exception_class(message, screen, stacktrace)
  859. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //img[@alt='Edit']
  860.  
  861. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  862. ________________________ test_modify_contact_firstname ________________________
  863.  
  864. app = <fixture.application.Application object at 0x0000000003EB3438>
  865.  
  866. def test_modify_contact_firstname(app):
  867. > app.contact.modify(Contact(firstname="New name"))
  868.  
  869. test_modify_contact.py:12:
  870. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  871. ..\fixture\contact.py:21: in modify
  872. wd.find_element_by_xpath("//img[@alt='Edit']").click()
  873. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:394: in find_element_by_xpath
  874. return self.find_element(by=By.XPATH, value=xpath)
  875. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:978: in find_element
  876. 'value': value})['value']
  877. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
  878. self.error_handler.check_response(response)
  879. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  880.  
  881. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0000000003EB3E80>
  882. response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: //img[@alt=\'Edit\'...ror@chrome://marionette/content/error.js:387:5\\nelement.find/</<@chrome://marionette/content/element.js:343:16\\n"}}'}
  883.  
  884. def check_response(self, response):
  885. """
  886. Checks that a JSON response from the WebDriver does not have an error.
  887.  
  888. :Args:
  889. - response - The JSON response from the WebDriver server as a dictionary
  890. object.
  891.  
  892. :Raises: If the response contains an error message.
  893. """
  894. status = response.get('status', None)
  895. if status is None or status == ErrorCode.SUCCESS:
  896. return
  897. value = None
  898. message = response.get("message", "")
  899. screen = response.get("screen", "")
  900. stacktrace = None
  901. if isinstance(status, int):
  902. value_json = response.get('value', None)
  903. if value_json and isinstance(value_json, basestring):
  904. import json
  905. try:
  906. value = json.loads(value_json)
  907. if len(value.keys()) == 1:
  908. value = value['value']
  909. status = value.get('error', None)
  910. if status is None:
  911. status = value["status"]
  912. message = value["value"]
  913. if not isinstance(message, basestring):
  914. value = message
  915. message = message.get('message')
  916. else:
  917. message = value.get('message', None)
  918. except ValueError:
  919. pass
  920.  
  921. exception_class = ErrorInResponseException
  922. if status in ErrorCode.NO_SUCH_ELEMENT:
  923. exception_class = NoSuchElementException
  924. elif status in ErrorCode.NO_SUCH_FRAME:
  925. exception_class = NoSuchFrameException
  926. elif status in ErrorCode.NO_SUCH_WINDOW:
  927. exception_class = NoSuchWindowException
  928. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  929. exception_class = StaleElementReferenceException
  930. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  931. exception_class = ElementNotVisibleException
  932. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  933. exception_class = InvalidElementStateException
  934. elif status in ErrorCode.INVALID_SELECTOR \
  935. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  936. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  937. exception_class = InvalidSelectorException
  938. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  939. exception_class = ElementNotSelectableException
  940. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  941. exception_class = ElementNotInteractableException
  942. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  943. exception_class = InvalidCookieDomainException
  944. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  945. exception_class = UnableToSetCookieException
  946. elif status in ErrorCode.TIMEOUT:
  947. exception_class = TimeoutException
  948. elif status in ErrorCode.SCRIPT_TIMEOUT:
  949. exception_class = TimeoutException
  950. elif status in ErrorCode.UNKNOWN_ERROR:
  951. exception_class = WebDriverException
  952. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  953. exception_class = UnexpectedAlertPresentException
  954. elif status in ErrorCode.NO_ALERT_OPEN:
  955. exception_class = NoAlertPresentException
  956. elif status in ErrorCode.IME_NOT_AVAILABLE:
  957. exception_class = ImeNotAvailableException
  958. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  959. exception_class = ImeActivationFailedException
  960. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  961. exception_class = MoveTargetOutOfBoundsException
  962. elif status in ErrorCode.JAVASCRIPT_ERROR:
  963. exception_class = JavascriptException
  964. elif status in ErrorCode.SESSION_NOT_CREATED:
  965. exception_class = SessionNotCreatedException
  966. elif status in ErrorCode.INVALID_ARGUMENT:
  967. exception_class = InvalidArgumentException
  968. elif status in ErrorCode.NO_SUCH_COOKIE:
  969. exception_class = NoSuchCookieException
  970. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  971. exception_class = ScreenshotException
  972. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  973. exception_class = ElementClickInterceptedException
  974. elif status in ErrorCode.INSECURE_CERTIFICATE:
  975. exception_class = InsecureCertificateException
  976. elif status in ErrorCode.INVALID_COORDINATES:
  977. exception_class = InvalidCoordinatesException
  978. elif status in ErrorCode.INVALID_SESSION_ID:
  979. exception_class = InvalidSessionIdException
  980. elif status in ErrorCode.UNKNOWN_METHOD:
  981. exception_class = UnknownMethodException
  982. else:
  983. exception_class = WebDriverException
  984. if value == '' or value is None:
  985. value = response['value']
  986. if isinstance(value, basestring):
  987. if exception_class == ErrorInResponseException:
  988. raise exception_class(response, value)
  989. raise exception_class(value)
  990. if message == "" and 'message' in value:
  991. message = value['message']
  992.  
  993. screen = None
  994. if 'screen' in value:
  995. screen = value['screen']
  996.  
  997. stacktrace = None
  998. if 'stackTrace' in value and value['stackTrace']:
  999. stacktrace = []
  1000. try:
  1001. for frame in value['stackTrace']:
  1002. line = self._value_or_default(frame, 'lineNumber', '')
  1003. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  1004. if line:
  1005. file = "%s:%s" % (file, line)
  1006. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  1007. if 'className' in frame:
  1008. meth = "%s.%s" % (frame['className'], meth)
  1009. msg = " at %s (%s)"
  1010. msg = msg % (meth, file)
  1011. stacktrace.append(msg)
  1012. except TypeError:
  1013. pass
  1014. if exception_class == ErrorInResponseException:
  1015. raise exception_class(response, message)
  1016. elif exception_class == UnexpectedAlertPresentException:
  1017. alert_text = None
  1018. if 'data' in value:
  1019. alert_text = value['data'].get('text')
  1020. elif 'alert' in value:
  1021. alert_text = value['alert'].get('text')
  1022. raise exception_class(message, screen, stacktrace, alert_text)
  1023. > raise exception_class(message, screen, stacktrace)
  1024. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //img[@alt='Edit']
  1025.  
  1026. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  1027. ======================== 3 failed, 7 passed in 44.07s =========================
  1028.  
  1029. Process finished with exit code 0
  1030.  
  1031. Assertion failed
  1032.  
  1033. Assertion failed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement