Guest User

Untitled

a guest
Jun 10th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.30 KB | None | 0 0
  1. Testing started at 22:29 ...
  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_modify_contact.py
  3. Launching py.test with arguments C:/Devel/python_training/test/test_modify_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_modify_contact.py F
  10. test_modify_contact.py:4 (test_modify_contact)
  11. app = <fixture.application.Application object at 0x03B2C1B0>
  12.  
  13. def test_modify_contact(app):
  14. app.open_home_page()
  15. if app.contact.count() == 0:
  16. app.contact.create_contact(Contact(name="Elena", surname="Darek", address="Test", phone="89210000000", email="elenadarek@gmail.com"))
  17. > app.contact.modify_first_contact(Contact(name="New name", surname="Ivanova", address="test_address", phone="89211110000", email="test@mail.com"))
  18.  
  19. test_modify_contact.py:9:
  20. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  21. ..\fixture\contact.py:48: in modify_first_contact
  22. self.select_first_contact()
  23. ..\fixture\contact.py:37: in select_first_contact
  24. wd.find_element_by_name("selected[]").click()
  25. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:489: in find_element_by_name
  26. return self.find_element(by=By.NAME, value=name)
  27. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:957: in find_element
  28. 'value': value})['value']
  29. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:314: in execute
  30. self.error_handler.check_response(response)
  31. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  32.  
  33. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x03B4CA90>
  34. response = {'status': 500, 'value': '{"name":"findElement","sessionId":"15e6a9e2-dc87-4ba6-94ea-849f8eaa5db6","status":7,"value":...pdfnnc3zn/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13335,"columnNumber":5}]}}'}
  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: {"method":"name","selector":"selected[]"}
  177. E Stacktrace:
  178. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/driver-component.js:11878)
  179. E at FirefoxDriver.prototype.findElement (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/driver-component.js:11887)
  180. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/command-processor.js:13388)
  181. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/command-processor.js:13393)
  182. E at DelayedCommand.prototype.execute/< (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/command-processor.js:13335)
  183.  
  184. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  185. [100%]
  186.  
  187. ================================== FAILURES ===================================
  188. _____________________________ test_modify_contact _____________________________
  189.  
  190. app = <fixture.application.Application object at 0x03B2C1B0>
  191.  
  192. def test_modify_contact(app):
  193. app.open_home_page()
  194. if app.contact.count() == 0:
  195. app.contact.create_contact(Contact(name="Elena", surname="Darek", address="Test", phone="89210000000", email="elenadarek@gmail.com"))
  196. > app.contact.modify_first_contact(Contact(name="New name", surname="Ivanova", address="test_address", phone="89211110000", email="test@mail.com"))
  197.  
  198. test_modify_contact.py:9:
  199. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  200. ..\fixture\contact.py:48: in modify_first_contact
  201. self.select_first_contact()
  202. ..\fixture\contact.py:37: in select_first_contact
  203. wd.find_element_by_name("selected[]").click()
  204. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:489: in find_element_by_name
  205. return self.find_element(by=By.NAME, value=name)
  206. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:957: in find_element
  207. 'value': value})['value']
  208. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:314: in execute
  209. self.error_handler.check_response(response)
  210. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  211.  
  212. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x03B4CA90>
  213. response = {'status': 500, 'value': '{"name":"findElement","sessionId":"15e6a9e2-dc87-4ba6-94ea-849f8eaa5db6","status":7,"value":...pdfnnc3zn/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13335,"columnNumber":5}]}}'}
  214.  
  215. def check_response(self, response):
  216. """
  217. Checks that a JSON response from the WebDriver does not have an error.
  218.  
  219. :Args:
  220. - response - The JSON response from the WebDriver server as a dictionary
  221. object.
  222.  
  223. :Raises: If the response contains an error message.
  224. """
  225. status = response.get('status', None)
  226. if status is None or status == ErrorCode.SUCCESS:
  227. return
  228. value = None
  229. message = response.get("message", "")
  230. screen = response.get("screen", "")
  231. stacktrace = None
  232. if isinstance(status, int):
  233. value_json = response.get('value', None)
  234. if value_json and isinstance(value_json, basestring):
  235. import json
  236. try:
  237. value = json.loads(value_json)
  238. if len(value.keys()) == 1:
  239. value = value['value']
  240. status = value.get('error', None)
  241. if status is None:
  242. status = value["status"]
  243. message = value["value"]
  244. if not isinstance(message, basestring):
  245. value = message
  246. message = message.get('message')
  247. else:
  248. message = value.get('message', None)
  249. except ValueError:
  250. pass
  251.  
  252. exception_class = ErrorInResponseException
  253. if status in ErrorCode.NO_SUCH_ELEMENT:
  254. exception_class = NoSuchElementException
  255. elif status in ErrorCode.NO_SUCH_FRAME:
  256. exception_class = NoSuchFrameException
  257. elif status in ErrorCode.NO_SUCH_WINDOW:
  258. exception_class = NoSuchWindowException
  259. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  260. exception_class = StaleElementReferenceException
  261. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  262. exception_class = ElementNotVisibleException
  263. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  264. exception_class = InvalidElementStateException
  265. elif status in ErrorCode.INVALID_SELECTOR \
  266. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  267. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  268. exception_class = InvalidSelectorException
  269. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  270. exception_class = ElementNotSelectableException
  271. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  272. exception_class = ElementNotInteractableException
  273. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  274. exception_class = InvalidCookieDomainException
  275. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  276. exception_class = UnableToSetCookieException
  277. elif status in ErrorCode.TIMEOUT:
  278. exception_class = TimeoutException
  279. elif status in ErrorCode.SCRIPT_TIMEOUT:
  280. exception_class = TimeoutException
  281. elif status in ErrorCode.UNKNOWN_ERROR:
  282. exception_class = WebDriverException
  283. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  284. exception_class = UnexpectedAlertPresentException
  285. elif status in ErrorCode.NO_ALERT_OPEN:
  286. exception_class = NoAlertPresentException
  287. elif status in ErrorCode.IME_NOT_AVAILABLE:
  288. exception_class = ImeNotAvailableException
  289. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  290. exception_class = ImeActivationFailedException
  291. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  292. exception_class = MoveTargetOutOfBoundsException
  293. elif status in ErrorCode.JAVASCRIPT_ERROR:
  294. exception_class = JavascriptException
  295. elif status in ErrorCode.SESSION_NOT_CREATED:
  296. exception_class = SessionNotCreatedException
  297. elif status in ErrorCode.INVALID_ARGUMENT:
  298. exception_class = InvalidArgumentException
  299. elif status in ErrorCode.NO_SUCH_COOKIE:
  300. exception_class = NoSuchCookieException
  301. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  302. exception_class = ScreenshotException
  303. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  304. exception_class = ElementClickInterceptedException
  305. elif status in ErrorCode.INSECURE_CERTIFICATE:
  306. exception_class = InsecureCertificateException
  307. elif status in ErrorCode.INVALID_COORDINATES:
  308. exception_class = InvalidCoordinatesException
  309. elif status in ErrorCode.INVALID_SESSION_ID:
  310. exception_class = InvalidSessionIdException
  311. elif status in ErrorCode.UNKNOWN_METHOD:
  312. exception_class = UnknownMethodException
  313. else:
  314. exception_class = WebDriverException
  315. if value == '' or value is None:
  316. value = response['value']
  317. if isinstance(value, basestring):
  318. if exception_class == ErrorInResponseException:
  319. raise exception_class(response, value)
  320. raise exception_class(value)
  321. if message == "" and 'message' in value:
  322. message = value['message']
  323.  
  324. screen = None
  325. if 'screen' in value:
  326. screen = value['screen']
  327.  
  328. stacktrace = None
  329. if 'stackTrace' in value and value['stackTrace']:
  330. stacktrace = []
  331. try:
  332. for frame in value['stackTrace']:
  333. line = self._value_or_default(frame, 'lineNumber', '')
  334. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  335. if line:
  336. file = "%s:%s" % (file, line)
  337. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  338. if 'className' in frame:
  339. meth = "%s.%s" % (frame['className'], meth)
  340. msg = " at %s (%s)"
  341. msg = msg % (meth, file)
  342. stacktrace.append(msg)
  343. except TypeError:
  344. pass
  345. if exception_class == ErrorInResponseException:
  346. raise exception_class(response, message)
  347. elif exception_class == UnexpectedAlertPresentException:
  348. alert_text = None
  349. if 'data' in value:
  350. alert_text = value['data'].get('text')
  351. elif 'alert' in value:
  352. alert_text = value['alert'].get('text')
  353. raise exception_class(message, screen, stacktrace, alert_text)
  354. > raise exception_class(message, screen, stacktrace)
  355. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"name","selector":"selected[]"}
  356. E Stacktrace:
  357. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/driver-component.js:11878)
  358. E at FirefoxDriver.prototype.findElement (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/driver-component.js:11887)
  359. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/command-processor.js:13388)
  360. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/command-processor.js:13393)
  361. E at DelayedCommand.prototype.execute/< (file:///C:/Users/user/AppData/Local/Temp/tmpdfnnc3zn/extensions/fxdriver@googlecode.com/components/command-processor.js:13335)
  362.  
  363. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException
  364. ========================== 1 failed in 13.25 seconds ==========================
  365. Process finished with exit code 0
Add Comment
Please, Sign In to add comment