Guest User

Untitled

a guest
Sep 14th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.00 KB | None | 0 0
  1. C:\python_training\env\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.7\helpers\pycharm\_jb_pytest_runner.py" --path C:/python_training/test/test_add_group.py
  2. Testing started at 20:25 ...
  3. Launching py.test with arguments C:/python_training/test/test_add_group.py in C:\python_training\test
  4.  
  5. ============================= test session starts =============================
  6. platform win32 -- Python 3.7.0, pytest-3.7.1, py-1.5.4, pluggy-0.7.1
  7. rootdir: C:\python_training\test, inifile:collected 2 items
  8.  
  9. test_add_group.py .E
  10. test setup failed
  11. request = <SubRequest 'app' for <Function 'test_add_empty_group'>>
  12.  
  13. @pytest.fixture
  14. def app(request):
  15. global fixture
  16. if fixture is None:
  17. fixture = Application()
  18. else:
  19. if not fixture.is_valid():
  20. fixture = Application()
  21. > fixture.session.ensure_login(username="admin", password="secret")
  22.  
  23. ..\conftest.py:15:
  24. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  25. ..\fixture\session.py:44: in ensure_login
  26. if self.is_logged_in_as(username):
  27. ..\fixture\session.py:38: in is_logged_in_as
  28. return len(wd.find_element_by_xpath("//div/div/[1]/from/b")).text == "("+usernamey+")"
  29. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:393: in find_element_by_xpath
  30. return self.find_element(by=By.XPATH, value=xpath)
  31. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:966: in find_element
  32. 'value': value})['value']
  33. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:320: in execute
  34. self.error_handler.check_response(response)
  35. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  36.  
  37. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0474D730>
  38. response = {'status': 500, 'value': '{"name":"findElement","sessionId":"319072ff-3159-4893-b8c8-abb8d8485de4","status":32,"value"...pry1z2690/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13335,"columnNumber":5}]}}'}
  39.  
  40. def check_response(self, response):
  41. """
  42. Checks that a JSON response from the WebDriver does not have an error.
  43.  
  44. :Args:
  45. - response - The JSON response from the WebDriver server as a dictionary
  46. object.
  47.  
  48. :Raises: If the response contains an error message.
  49. """
  50. status = response.get('status', None)
  51. if status is None or status == ErrorCode.SUCCESS:
  52. return
  53. value = None
  54. message = response.get("message", "")
  55. screen = response.get("screen", "")
  56. stacktrace = None
  57. if isinstance(status, int):
  58. value_json = response.get('value', None)
  59. if value_json and isinstance(value_json, basestring):
  60. import json
  61. try:
  62. value = json.loads(value_json)
  63. if len(value.keys()) == 1:
  64. value = value['value']
  65. status = value.get('error', None)
  66. if status is None:
  67. status = value["status"]
  68. message = value["value"]
  69. if not isinstance(message, basestring):
  70. value = message
  71. message = message.get('message')
  72. else:
  73. message = value.get('message', None)
  74. except ValueError:
  75. pass
  76.  
  77. exception_class = ErrorInResponseException
  78. if status in ErrorCode.NO_SUCH_ELEMENT:
  79. exception_class = NoSuchElementException
  80. elif status in ErrorCode.NO_SUCH_FRAME:
  81. exception_class = NoSuchFrameException
  82. elif status in ErrorCode.NO_SUCH_WINDOW:
  83. exception_class = NoSuchWindowException
  84. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  85. exception_class = StaleElementReferenceException
  86. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  87. exception_class = ElementNotVisibleException
  88. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  89. exception_class = InvalidElementStateException
  90. elif status in ErrorCode.INVALID_SELECTOR \
  91. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  92. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  93. exception_class = InvalidSelectorException
  94. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  95. exception_class = ElementNotSelectableException
  96. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  97. exception_class = ElementNotInteractableException
  98. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  99. exception_class = InvalidCookieDomainException
  100. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  101. exception_class = UnableToSetCookieException
  102. elif status in ErrorCode.TIMEOUT:
  103. exception_class = TimeoutException
  104. elif status in ErrorCode.SCRIPT_TIMEOUT:
  105. exception_class = TimeoutException
  106. elif status in ErrorCode.UNKNOWN_ERROR:
  107. exception_class = WebDriverException
  108. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  109. exception_class = UnexpectedAlertPresentException
  110. elif status in ErrorCode.NO_ALERT_OPEN:
  111. exception_class = NoAlertPresentException
  112. elif status in ErrorCode.IME_NOT_AVAILABLE:
  113. exception_class = ImeNotAvailableException
  114. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  115. exception_class = ImeActivationFailedException
  116. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  117. exception_class = MoveTargetOutOfBoundsException
  118. elif status in ErrorCode.JAVASCRIPT_ERROR:
  119. exception_class = JavascriptException
  120. elif status in ErrorCode.SESSION_NOT_CREATED:
  121. exception_class = SessionNotCreatedException
  122. elif status in ErrorCode.INVALID_ARGUMENT:
  123. exception_class = InvalidArgumentException
  124. elif status in ErrorCode.NO_SUCH_COOKIE:
  125. exception_class = NoSuchCookieException
  126. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  127. exception_class = ScreenshotException
  128. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  129. exception_class = ElementClickInterceptedException
  130. elif status in ErrorCode.INSECURE_CERTIFICATE:
  131. exception_class = InsecureCertificateException
  132. elif status in ErrorCode.INVALID_COORDINATES:
  133. exception_class = InvalidCoordinatesException
  134. elif status in ErrorCode.INVALID_SESSION_ID:
  135. exception_class = InvalidSessionIdException
  136. elif status in ErrorCode.UNKNOWN_METHOD:
  137. exception_class = UnknownMethodException
  138. else:
  139. exception_class = WebDriverException
  140. if value == '' or value is None:
  141. value = response['value']
  142. if isinstance(value, basestring):
  143. if exception_class == ErrorInResponseException:
  144. raise exception_class(response, value)
  145. raise exception_class(value)
  146. if message == "" and 'message' in value:
  147. message = value['message']
  148.  
  149. screen = None
  150. if 'screen' in value:
  151. screen = value['screen']
  152.  
  153. stacktrace = None
  154. if 'stackTrace' in value and value['stackTrace']:
  155. stacktrace = []
  156. try:
  157. for frame in value['stackTrace']:
  158. line = self._value_or_default(frame, 'lineNumber', '')
  159. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  160. if line:
  161. file = "%s:%s" % (file, line)
  162. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  163. if 'className' in frame:
  164. meth = "%s.%s" % (frame['className'], meth)
  165. msg = " at %s (%s)"
  166. msg = msg % (meth, file)
  167. stacktrace.append(msg)
  168. except TypeError:
  169. pass
  170. if exception_class == ErrorInResponseException:
  171. raise exception_class(response, message)
  172. elif exception_class == UnexpectedAlertPresentException:
  173. alert_text = None
  174. if 'data' in value:
  175. alert_text = value['data'].get('text')
  176. elif 'alert' in value:
  177. alert_text = value['alert'].get('text')
  178. raise exception_class(message, screen, stacktrace, alert_text)
  179. > raise exception_class(message, screen, stacktrace)
  180. E selenium.common.exceptions.InvalidSelectorException: Message: The given selector //div/div/[1]/from/b is either invalid or does not result in a WebElement. The following error occurred:
  181. E InvalidSelectorError: Unable to locate an element with the xpath expression //div/div/[1]/from/b because of the following error:
  182. E SyntaxError: The expression is not a legal expression.
  183. E Stacktrace:
  184. E at FirefoxDriver.annotateInvalidSelectorError_ (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/driver-component.js:11852)
  185. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/driver-component.js:11883)
  186. E at FirefoxDriver.prototype.findElement (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/driver-component.js:11887)
  187. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/command-processor.js:13388)
  188. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/command-processor.js:13393)
  189. E at DelayedCommand.prototype.execute/< (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/command-processor.js:13335)
  190.  
  191. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: InvalidSelectorException
  192. [100%]
  193.  
  194. =================================== ERRORS ====================================
  195. ___________________ ERROR at setup of test_add_empty_group ____________________
  196.  
  197. request = <SubRequest 'app' for <Function 'test_add_empty_group'>>
  198.  
  199. @pytest.fixture
  200. def app(request):
  201. global fixture
  202. if fixture is None:
  203. fixture = Application()
  204. else:
  205. if not fixture.is_valid():
  206. fixture = Application()
  207. > fixture.session.ensure_login(username="admin", password="secret")
  208.  
  209. ..\conftest.py:15:
  210. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  211. ..\fixture\session.py:44: in ensure_login
  212. if self.is_logged_in_as(username):
  213. ..\fixture\session.py:38: in is_logged_in_as
  214. return len(wd.find_element_by_xpath("//div/div/[1]/from/b")).text == "("+usernamey+")"
  215. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:393: in find_element_by_xpath
  216. return self.find_element(by=By.XPATH, value=xpath)
  217. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:966: in find_element
  218. 'value': value})['value']
  219. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:320: in execute
  220. self.error_handler.check_response(response)
  221. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  222.  
  223. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x0474D730>
  224. response = {'status': 500, 'value': '{"name":"findElement","sessionId":"319072ff-3159-4893-b8c8-abb8d8485de4","status":32,"value"...pry1z2690/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13335,"columnNumber":5}]}}'}
  225.  
  226. def check_response(self, response):
  227. """
  228. Checks that a JSON response from the WebDriver does not have an error.
  229.  
  230. :Args:
  231. - response - The JSON response from the WebDriver server as a dictionary
  232. object.
  233.  
  234. :Raises: If the response contains an error message.
  235. """
  236. status = response.get('status', None)
  237. if status is None or status == ErrorCode.SUCCESS:
  238. return
  239. value = None
  240. message = response.get("message", "")
  241. screen = response.get("screen", "")
  242. stacktrace = None
  243. if isinstance(status, int):
  244. value_json = response.get('value', None)
  245. if value_json and isinstance(value_json, basestring):
  246. import json
  247. try:
  248. value = json.loads(value_json)
  249. if len(value.keys()) == 1:
  250. value = value['value']
  251. status = value.get('error', None)
  252. if status is None:
  253. status = value["status"]
  254. message = value["value"]
  255. if not isinstance(message, basestring):
  256. value = message
  257. message = message.get('message')
  258. else:
  259. message = value.get('message', None)
  260. except ValueError:
  261. pass
  262.  
  263. exception_class = ErrorInResponseException
  264. if status in ErrorCode.NO_SUCH_ELEMENT:
  265. exception_class = NoSuchElementException
  266. elif status in ErrorCode.NO_SUCH_FRAME:
  267. exception_class = NoSuchFrameException
  268. elif status in ErrorCode.NO_SUCH_WINDOW:
  269. exception_class = NoSuchWindowException
  270. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  271. exception_class = StaleElementReferenceException
  272. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  273. exception_class = ElementNotVisibleException
  274. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  275. exception_class = InvalidElementStateException
  276. elif status in ErrorCode.INVALID_SELECTOR \
  277. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  278. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  279. exception_class = InvalidSelectorException
  280. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  281. exception_class = ElementNotSelectableException
  282. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  283. exception_class = ElementNotInteractableException
  284. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  285. exception_class = InvalidCookieDomainException
  286. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  287. exception_class = UnableToSetCookieException
  288. elif status in ErrorCode.TIMEOUT:
  289. exception_class = TimeoutException
  290. elif status in ErrorCode.SCRIPT_TIMEOUT:
  291. exception_class = TimeoutException
  292. elif status in ErrorCode.UNKNOWN_ERROR:
  293. exception_class = WebDriverException
  294. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  295. exception_class = UnexpectedAlertPresentException
  296. elif status in ErrorCode.NO_ALERT_OPEN:
  297. exception_class = NoAlertPresentException
  298. elif status in ErrorCode.IME_NOT_AVAILABLE:
  299. exception_class = ImeNotAvailableException
  300. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  301. exception_class = ImeActivationFailedException
  302. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  303. exception_class = MoveTargetOutOfBoundsException
  304. elif status in ErrorCode.JAVASCRIPT_ERROR:
  305. exception_class = JavascriptException
  306. elif status in ErrorCode.SESSION_NOT_CREATED:
  307. exception_class = SessionNotCreatedException
  308. elif status in ErrorCode.INVALID_ARGUMENT:
  309. exception_class = InvalidArgumentException
  310. elif status in ErrorCode.NO_SUCH_COOKIE:
  311. exception_class = NoSuchCookieException
  312. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  313. exception_class = ScreenshotException
  314. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  315. exception_class = ElementClickInterceptedException
  316. elif status in ErrorCode.INSECURE_CERTIFICATE:
  317. exception_class = InsecureCertificateException
  318. elif status in ErrorCode.INVALID_COORDINATES:
  319. exception_class = InvalidCoordinatesException
  320. elif status in ErrorCode.INVALID_SESSION_ID:
  321. exception_class = InvalidSessionIdException
  322. elif status in ErrorCode.UNKNOWN_METHOD:
  323. exception_class = UnknownMethodException
  324. else:
  325. exception_class = WebDriverException
  326. if value == '' or value is None:
  327. value = response['value']
  328. if isinstance(value, basestring):
  329. if exception_class == ErrorInResponseException:
  330. raise exception_class(response, value)
  331. raise exception_class(value)
  332. if message == "" and 'message' in value:
  333. message = value['message']
  334.  
  335. screen = None
  336. if 'screen' in value:
  337. screen = value['screen']
  338.  
  339. stacktrace = None
  340. if 'stackTrace' in value and value['stackTrace']:
  341. stacktrace = []
  342. try:
  343. for frame in value['stackTrace']:
  344. line = self._value_or_default(frame, 'lineNumber', '')
  345. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  346. if line:
  347. file = "%s:%s" % (file, line)
  348. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  349. if 'className' in frame:
  350. meth = "%s.%s" % (frame['className'], meth)
  351. msg = " at %s (%s)"
  352. msg = msg % (meth, file)
  353. stacktrace.append(msg)
  354. except TypeError:
  355. pass
  356. if exception_class == ErrorInResponseException:
  357. raise exception_class(response, message)
  358. elif exception_class == UnexpectedAlertPresentException:
  359. alert_text = None
  360. if 'data' in value:
  361. alert_text = value['data'].get('text')
  362. elif 'alert' in value:
  363. alert_text = value['alert'].get('text')
  364. raise exception_class(message, screen, stacktrace, alert_text)
  365. > raise exception_class(message, screen, stacktrace)
  366. E selenium.common.exceptions.InvalidSelectorException: Message: The given selector //div/div/[1]/from/b is either invalid or does not result in a WebElement. The following error occurred:
  367. E InvalidSelectorError: Unable to locate an element with the xpath expression //div/div/[1]/from/b because of the following error:
  368. E SyntaxError: The expression is not a legal expression.
  369. E Stacktrace:
  370. E at FirefoxDriver.annotateInvalidSelectorError_ (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/driver-component.js:11852)
  371. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/driver-component.js:11883)
  372. E at FirefoxDriver.prototype.findElement (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/driver-component.js:11887)
  373. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/command-processor.js:13388)
  374. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/command-processor.js:13393)
  375. E at DelayedCommand.prototype.execute/< (file:///C:/Users/lukasz/AppData/Local/Temp/tmpry1z2690/extensions/fxdriver@googlecode.com/components/command-processor.js:13335)
  376.  
  377. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: InvalidSelectorException
  378. ===================== 1 passed, 1 error in 93.83 seconds ======================
  379. Process finished with exit code 0
Add Comment
Please, Sign In to add comment