Guest User

Untitled

a guest
Apr 3rd, 2018
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.29 KB | None | 0 0
  1. Testing started at 22:20 ...
  2. D:\python\python_for_testing\env\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\pycharm\_jb_pytest_runner.py" --path D:/python/python_for_testing/test/test_edit_contact.py
  3. Launching py.test with arguments D:/python/python_for_testing/test/test_edit_contact.py in D:\python\python_for_testing\test
  4.  
  5. ============================= test session starts =============================
  6. platform win32 -- Python 3.6.0, pytest-3.3.2, py-1.5.2, pluggy-0.6.0
  7. rootdir: D:\python\python_for_testing\test, inifile:
  8. collected 1 item
  9. test_edit_contact.py F [100%]
  10. test_edit_contact.py:5 (test_edit_contact_from_above)
  11. app = <fixture.application.Application object at 0x03485F90>
  12. db = <fixture.db.DbFixture object at 0x0348BFB0>, check_ui = False
  13.  
  14. def test_edit_contact_from_above(app, db, check_ui):
  15. if len(db.get_contact_list()) == 0:
  16. app.contact.create(Contact(firstname="test", middlename="1", lastname="1", company="1", address="1", mobile="1", byear="1"))
  17. old_contacts = db.get_contact_list()
  18. contact = random.choice(old_contacts)
  19. contact.firstname = 'edit_contact'
  20. > app.contact.edit_contact_from_above_by_id(contact, contact.id)
  21.  
  22. test_edit_contact.py:12:
  23. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  24. ..\fixture\contact.py:125: in edit_contact_from_above_by_id
  25. self.pencil_by_id(id)
  26. ..\fixture\contact.py:94: in pencil_by_id
  27. id_temp = element.find_element_by_name("selected[]").get_attribute("value")
  28. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:209: in find_element_by_name
  29. return self.find_element(by=By.NAME, value=name)
  30. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:645: in find_element
  31. {"using": by, "value": value})['value']
  32. ..\env\lib\site-packages\selenium\webdriver\remote\webelement.py:628: in _execute
  33. return self._parent.execute(command, params)
  34. ..\env\lib\site-packages\selenium\webdriver\remote\webdriver.py:312: in execute
  35. self.error_handler.check_response(response)
  36. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  37.  
  38. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x03473710>
  39. response = {'status': 500, 'value': '{"name":"findChildElement","sessionId":"bff6c9db-0fa3-4d23-a9e5-f50c12aa2c29","status":10,"v...pz4e7zrp0/extensions/fxdriver@googlecode.com/components/command-processor.js","lineNumber":13325,"columnNumber":5}]}}'}
  40.  
  41. def check_response(self, response):
  42. """
  43. Checks that a JSON response from the WebDriver does not have an error.
  44.  
  45. :Args:
  46. - response - The JSON response from the WebDriver server as a dictionary
  47. object.
  48.  
  49. :Raises: If the response contains an error message.
  50. """
  51. status = response.get('status', None)
  52. if status is None or status == ErrorCode.SUCCESS:
  53. return
  54. value = None
  55. message = response.get("message", "")
  56. screen = response.get("screen", "")
  57. stacktrace = None
  58. if isinstance(status, int):
  59. value_json = response.get('value', None)
  60. if value_json and isinstance(value_json, basestring):
  61. import json
  62. try:
  63. value = json.loads(value_json)
  64. if len(value.keys()) == 1:
  65. value = value['value']
  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. message = message.get('message')
  73. else:
  74. message = value.get('message', None)
  75. except ValueError:
  76. pass
  77.  
  78. exception_class = ErrorInResponseException
  79. if status in ErrorCode.NO_SUCH_ELEMENT:
  80. exception_class = NoSuchElementException
  81. elif status in ErrorCode.NO_SUCH_FRAME:
  82. exception_class = NoSuchFrameException
  83. elif status in ErrorCode.NO_SUCH_WINDOW:
  84. exception_class = NoSuchWindowException
  85. elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  86. exception_class = StaleElementReferenceException
  87. elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  88. exception_class = ElementNotVisibleException
  89. elif status in ErrorCode.INVALID_ELEMENT_STATE:
  90. exception_class = InvalidElementStateException
  91. elif status in ErrorCode.INVALID_SELECTOR \
  92. or status in ErrorCode.INVALID_XPATH_SELECTOR \
  93. or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  94. exception_class = InvalidSelectorException
  95. elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  96. exception_class = ElementNotSelectableException
  97. elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  98. exception_class = ElementNotInteractableException
  99. elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  100. exception_class = InvalidCookieDomainException
  101. elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  102. exception_class = UnableToSetCookieException
  103. elif status in ErrorCode.TIMEOUT:
  104. exception_class = TimeoutException
  105. elif status in ErrorCode.SCRIPT_TIMEOUT:
  106. exception_class = TimeoutException
  107. elif status in ErrorCode.UNKNOWN_ERROR:
  108. exception_class = WebDriverException
  109. elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  110. exception_class = UnexpectedAlertPresentException
  111. elif status in ErrorCode.NO_ALERT_OPEN:
  112. exception_class = NoAlertPresentException
  113. elif status in ErrorCode.IME_NOT_AVAILABLE:
  114. exception_class = ImeNotAvailableException
  115. elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  116. exception_class = ImeActivationFailedException
  117. elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  118. exception_class = MoveTargetOutOfBoundsException
  119. elif status in ErrorCode.JAVASCRIPT_ERROR:
  120. exception_class = JavascriptException
  121. elif status in ErrorCode.SESSION_NOT_CREATED:
  122. exception_class = SessionNotCreatedException
  123. elif status in ErrorCode.INVALID_ARGUMENT:
  124. exception_class = InvalidArgumentException
  125. elif status in ErrorCode.NO_SUCH_COOKIE:
  126. exception_class = NoSuchCookieException
  127. elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  128. exception_class = ScreenshotException
  129. elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  130. exception_class = ElementClickInterceptedException
  131. elif status in ErrorCode.INSECURE_CERTIFICATE:
  132. exception_class = InsecureCertificateException
  133. elif status in ErrorCode.INVALID_COORDINATES:
  134. exception_class = InvalidCoordinatesException
  135. elif status in ErrorCode.INVALID_SESSION_ID:
  136. exception_class = InvalidSessionIdException
  137. elif status in ErrorCode.UNKNOWN_METHOD:
  138. exception_class = UnknownMethodException
  139. else:
  140. exception_class = WebDriverException
  141. if value == '' or value is None:
  142. value = response['value']
  143. if isinstance(value, basestring):
  144. if exception_class == ErrorInResponseException:
  145. raise exception_class(response, value)
  146. raise exception_class(value)
  147. if message == "" and 'message' in value:
  148. message = value['message']
  149.  
  150. screen = None
  151. if 'screen' in value:
  152. screen = value['screen']
  153.  
  154. stacktrace = None
  155. if 'stackTrace' in value and value['stackTrace']:
  156. stacktrace = []
  157. try:
  158. for frame in value['stackTrace']:
  159. line = self._value_or_default(frame, 'lineNumber', '')
  160. file = self._value_or_default(frame, 'fileName', '<anonymous>')
  161. if line:
  162. file = "%s:%s" % (file, line)
  163. meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  164. if 'className' in frame:
  165. meth = "%s.%s" % (frame['className'], meth)
  166. msg = " at %s (%s)"
  167. msg = msg % (meth, file)
  168. stacktrace.append(msg)
  169. except TypeError:
  170. pass
  171. if exception_class == ErrorInResponseException:
  172. raise exception_class(response, message)
  173. elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
  174. raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
  175. > raise exception_class(message, screen, stacktrace)
  176. E selenium.common.exceptions.StaleElementReferenceException: Message: Element not found in the cache - perhaps the page has changed since it was looked up
  177. E Stacktrace:
  178. E at fxdriver.cache.getElementAt (resource://fxdriver/modules/web-element-cache.js:9064)
  179. E at Utils.getElementAt (file:///C:/Users/Oksana/AppData/Local/Temp/tmpz4e7zrp0/extensions/fxdriver@googlecode.com/components/driver-component.js:10592)
  180. E at FirefoxDriver.prototype.findElementInternal_ (file:///C:/Users/Oksana/AppData/Local/Temp/tmpz4e7zrp0/extensions/fxdriver@googlecode.com/components/driver-component.js:11874)
  181. E at FirefoxDriver.prototype.findChildElement (file:///C:/Users/Oksana/AppData/Local/Temp/tmpz4e7zrp0/extensions/fxdriver@googlecode.com/components/driver-component.js:11896)
  182. E at DelayedCommand.prototype.executeInternal_/k (file:///C:/Users/Oksana/AppData/Local/Temp/tmpz4e7zrp0/extensions/fxdriver@googlecode.com/components/command-processor.js:13378)
  183. E at DelayedCommand.prototype.executeInternal_ (file:///C:/Users/Oksana/AppData/Local/Temp/tmpz4e7zrp0/extensions/fxdriver@googlecode.com/components/command-processor.js:13383)
  184. E at DelayedCommand.prototype.execute/< (file:///C:/Users/Oksana/AppData/Local/Temp/tmpz4e7zrp0/extensions/fxdriver@googlecode.com/components/command-processor.js:13325)
  185.  
  186. ..\env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:237: StaleElementReferenceException
Add Comment
Please, Sign In to add comment