Advertisement
Guest User

Untitled

a guest
Apr 17th, 2017
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.01 KB | None | 0 0
  1. exc 1
  2. after writing in the console py.test test_add_group.py
  3. Twice the test has run. First went throught logi in, than entered add group website and on the group name was stuck for around1-20 sec and exit.
  4. And straight after test has been run again. Log in was successful, the name of the group also and nothing else happened. After a while a received the comment below:
  5.  
  6. following comment
  7. ============================================================================================================================= test session starts ==============================================================================================================================
  8. platform darwin -- Python 3.6.1, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
  9. rootdir: /Users/Gosia/PycharmProjects/py_training, inifile:
  10. collected 2 items
  11.  
  12. test_add_group.py FF
  13.  
  14. =================================================================================================================================== FAILURES ===================================================================================================================================
  15. ______________________________________________________________________________________________________________________ test_add_group.test_add_empy_group ______________________________________________________________________________________________________________________
  16.  
  17. self = <test_add_group.test_add_group testMethod=test_add_empy_group>
  18.  
  19. def test_add_empy_group(self):
  20. wd = self.wd
  21. self.open_home_page(wd)
  22. self.login(wd, password="secret", username="admin")
  23. self.open_group_page(wd)
  24. self.init_group_creation(wd)
  25. > self.fill_group_form(wd, Group(name="", header="", footer=""))
  26.  
  27. test_add_group.py:39:
  28. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  29. test_add_group.py:59: in fill_group_form
  30. "//div[@id='content']//select[normalize-space(.)='[none] abc']//option[1]").is_selected():
  31. /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:293: in find_element_by_xpath
  32. return self.find_element(by=By.XPATH, value=xpath)
  33. /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:752: in find_element
  34. 'value': value})['value']
  35. /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:236: in execute
  36. self.error_handler.check_response(response)
  37. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  38.  
  39. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x103a4bb70>
  40. response = {'status': 500, 'value': '{"name":"findElement","sessionId":"8533b2c6-34c9-0045-810d-fe45dc6b8046","status":7,"value":.../tmppbk5p_yl/extensions/fxdriver@googlecode.com/components/driver-component.js","lineNumber":625,"columnNumber":5}]}}'}
  41.  
  42. def check_response(self, response):
  43. """
  44. Checks that a JSON response from the WebDriver does not have an error.
  45.  
  46. :Args:
  47. - response - The JSON response from the WebDriver server as a dictionary
  48. object.
  49.  
  50. :Raises: If the response contains an error message.
  51. """
  52. status = response.get('status', None)
  53. if status is None or status == ErrorCode.SUCCESS:
  54. return
  55.  
  56. value = None
  57. message = response.get("message", "")
  58. screen = response.get("screen", "")
  59. stacktrace = None
  60. if isinstance(status, int):
  61. value_json = response.get('value', None)
  62. if value_json and isinstance(value_json, basestring):
  63. import json
  64. try:
  65. value = json.loads(value_json)
  66. status = value.get('error', None)
  67. if status is None:
  68. status = value["status"]
  69. message = value["value"]
  70. if not isinstance(message, basestring):
  71. value = message
  72. try:
  73. message = message['message']
  74. except TypeError:
  75. message = None
  76. else:
  77. message = value.get('message', None)
  78. except ValueError:
  79. pass
  80.  
  81. exception_class = ErrorInResponseException
  82. if status in ErrorCode.NO_SUCH_ELEMENT:
  83. exception_class = NoSuchElementException
  84. elif status in ErrorCode.NO_SUCH_FRAME:
  85. exception_class = NoSuchFrameException
  86. elif status in ErrorCode.NO_SUCH_WINDOW:
  87. exception_class = NoSuchWindowException
  88. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  89. exception_class = StaleElementReferenceException
  90. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  91. exception_class = ElementNotVisibleException
  92. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  93. exception_class = InvalidElementStateException
  94. elif status in ErrorCode.INVALID_SELECTOR \
  95. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  96. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  97. exception_class = InvalidSelectorException
  98. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  99. exception_class = ElementNotSelectableException
  100. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  101. exception_class = WebDriverException
  102. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  103. exception_class = WebDriverException
  104. elif status in ErrorCode.TIMEOUT:
  105. exception_class = TimeoutException
  106. elif status in ErrorCode.SCRIPT_TIMEOUT:
  107. exception_class = TimeoutException
  108. elif status in ErrorCode.UNKNOWN_ERROR:
  109. exception_class = WebDriverException
  110. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  111. exception_class = UnexpectedAlertPresentException
  112. elif status in ErrorCode.NO_ALERT_OPEN:
  113. exception_class = NoAlertPresentException
  114. elif status in ErrorCode.IME_NOT_AVAILABLE:
  115. exception_class = ImeNotAvailableException
  116. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  117. exception_class = ImeActivationFailedException
  118. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  119. exception_class = MoveTargetOutOfBoundsException
  120. else:
  121. exception_class = WebDriverException
  122. if value == '' or value is None:
  123. value = response['value']
  124. if isinstance(value, basestring):
  125. if exception_class == ErrorInResponseException:
  126. raise exception_class(response, value)
  127. raise exception_class(value)
  128. if message == "" and 'message' in value:
  129. message = value['message']
  130.  
  131. screen = None
  132. if 'screen' in value:
  133. screen = value['screen']
  134.  
  135. stacktrace = None
  136. if 'stackTrace' in value and value['stackTrace']:
  137. stacktrace = []
  138. try:
  139. for frame in value['stackTrace']:
  140. line = self._value_or_default(frame, 'lineNumber', '')
  141. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  142. if line:
  143. file = "%s:%s" % (file, line)
  144. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  145. if 'className' in frame:
  146. meth = "%s.%s" % (frame['className'], meth)
  147. msg = " at %s (%s)"
  148. msg = msg % (meth, file)
  149. stacktrace.append(msg)
  150. except TypeError:
  151. pass
  152. if exception_class == ErrorInResponseException:
  153. raise exception_class(response, message)
  154. elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
  155. raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
  156. > raise exception_class(message, screen, stacktrace)
  157. E selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"//div[@id='content']//select[normalize-space(.)='[none] abc']//option[1]"}
  158. E Stacktrace:
  159. E at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/07/pwss_zm91wj4_jgd2wg3608c0000gn/T/tmppbk5p_yl/extensions/fxdriver@googlecode.com/components/driver-component.js:10770)
  160. E at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/07/pwss_zm91wj4_jgd2wg3608c0000gn/T/tmppbk5p_yl/extensions/fxdriver@googlecode.com/components/driver-component.js:625)
  161.  
  162. /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:192: NoSuchElementException
  163. ________________________________________________________________________________________________________________________ test_add_group.test_add_group _________________________________________________________________________________________________________________________
  164.  
  165. self = <test_add_group.test_add_group testMethod=test_add_group>
  166.  
  167. def test_add_group(self):
  168. wd = self.wd
  169. self.open_home_page(wd)
  170. self.login(wd, password="secret", username="admin")
  171. self.open_group_page(wd)
  172. self.init_group_creation(wd)
  173. > self.fill_group_form(wd, Group(name="group1",header="group1", footer="group1"))
  174.  
  175. test_add_group.py:28:
  176. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  177. test_add_group.py:59: in fill_group_form
  178. "//div[@id='content']//select[normalize-space(.)='[none] abc']//option[1]").is_selected():
  179. /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:293: in find_element_by_xpath
  180. return self.find_element(by=By.XPATH, value=xpath)
  181. /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:752: in find_element
  182. 'value': value})['value']
  183. /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:236: in execute
  184. self.error_handl
  185.  
  186.  
  187.  
  188. -----
  189. comments in the console when test has been run in pycharm
  190. /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/Gosia/PycharmProjects/py_training/myenv/test_add_group.py
  191. EE
  192. ======================================================================
  193. ERROR: test_add_empy_group (__main__.test_add_group)
  194. ----------------------------------------------------------------------
  195. Traceback (most recent call last):
  196. File "/Users/Gosia/PycharmProjects/py_training/myenv/test_add_group.py", line 42, in test_add_empy_group
  197. self.fill_group_form(wd, Group(name="", header="", footer=""))
  198. File "/Users/Gosia/PycharmProjects/py_training/myenv/test_add_group.py", line 62, in fill_group_form
  199. "//div[@id='content']//select[normalize-space(.)='[none] abc']//option[1]").is_selected():
  200. File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 293, in find_element_by_xpath
  201. return self.find_element(by=By.XPATH, value=xpath)
  202. File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 752, in find_element
  203. 'value': value})['value']
  204. File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
  205. self.error_handler.check_response(response)
  206. File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
  207. raise exception_class(message, screen, stacktrace)
  208. selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"//div[@id='content']//select[normalize-space(.)='[none] abc']//option[1]"}
  209. Stacktrace:
  210. at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/07/pwss_zm91wj4_jgd2wg3608c0000gn/T/tmp7z_8oznc/extensions/fxdriver@googlecode.com/components/driver-component.js:10770)
  211. at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/07/pwss_zm91wj4_jgd2wg3608c0000gn/T/tmp7z_8oznc/extensions/fxdriver@googlecode.com/components/driver-component.js:625)
  212.  
  213. ======================================================================
  214. ERROR: test_add_group (__main__.test_add_group)
  215. ----------------------------------------------------------------------
  216. Traceback (most recent call last):
  217. File "/Users/Gosia/PycharmProjects/py_training/myenv/test_add_group.py", line 31, in test_add_group
  218. self.fill_group_form(wd, Group(name="group1",header="group1", footer="group1"))
  219. File "/Users/Gosia/PycharmProjects/py_training/myenv/test_add_group.py", line 62, in fill_group_form
  220. "//div[@id='content']//select[normalize-space(.)='[none] abc']//option[1]").is_selected():
  221. File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 293, in find_element_by_xpath
  222. return self.find_element(by=By.XPATH, value=xpath)
  223. File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 752, in find_element
  224. 'value': value})['value']
  225. File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
  226. self.error_handler.check_response(response)
  227. File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
  228. raise exception_class(message, screen, stacktrace)
  229. selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"//div[@id='content']//select[normalize-space(.)='[none] abc']//option[1]"}
  230. Stacktrace:
  231. at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/07/pwss_zm91wj4_jgd2wg3608c0000gn/T/tmp1i_cq9x5/extensions/fxdriver@googlecode.com/components/driver-component.js:10770)
  232. at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/07/pwss_zm91wj4_jgd2wg3608c0000gn/T/tmp1i_cq9x5/extensions/fxdriver@googlecode.com/components/driver-component.js:625)
  233.  
  234. ----------------------------------------------------------------------
  235. Ran 2 tests in 129.124s
  236.  
  237. FAILED (errors=2)
  238.  
  239. Process finished with exit code 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement