Guest User

Error

a guest
Jan 25th, 2021
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.60 KB | None | 0 0
  1. Run pytest test.py
  2.   pytest test.py
  3.   continue-on-error: true
  4.   shell: /bin/bash -e {0}
  5.   env:
  6.     pythonLocation: /opt/hostedtoolcache/Python/3.9.1/x64
  7.     LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.1/x64/lib
  8. ============================= test session starts ==============================
  9. platform linux -- Python 3.9.1, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
  10. rootdir: /home/runner/work/website-testing-test/website-testing-test
  11. collected 1 item
  12.  
  13. test.py F                                                                [100%]
  14.  
  15. =================================== FAILURES ===================================
  16. __________________________________ test_title __________________________________
  17.  
  18.     def test_title():
  19. >       driver.get('https://www.google.com/')
  20.  
  21. test.py:12:
  22. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  23. /opt/hostedtoolcache/Python/3.9.1/x64/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:333: in get
  24.     self.execute(Command.GET, {'url': url})
  25. /opt/hostedtoolcache/Python/3.9.1/x64/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
  26.     self.error_handler.check_response(response)
  27. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  28.  
  29. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fe572911070>
  30. response = {'status': 404, 'value': '{"status":13,"value":{"message":"Session timed out or not found"}}\n'}
  31.  
  32.     def check_response(self, response):
  33.         """
  34.        Checks that a JSON response from the WebDriver does not have an error.
  35.    
  36.        :Args:
  37.         - response - The JSON response from the WebDriver server as a dictionary
  38.           object.
  39.    
  40.        :Raises: If the response contains an error message.
  41.        """
  42.         status = response.get('status', None)
  43.         if status is None or status == ErrorCode.SUCCESS:
  44.             return
  45.         value = None
  46.         message = response.get("message", "")
  47.         screen = response.get("screen", "")
  48.         stacktrace = None
  49.         if isinstance(status, int):
  50.             value_json = response.get('value', None)
  51.             if value_json and isinstance(value_json, basestring):
  52.                 import json
  53.                 try:
  54.                     value = json.loads(value_json)
  55.                     if len(value.keys()) == 1:
  56.                         value = value['value']
  57.                     status = value.get('error', None)
  58.                     if status is None:
  59.                         status = value["status"]
  60.                         message = value["value"]
  61.                         if not isinstance(message, basestring):
  62.                             value = message
  63.                             message = message.get('message')
  64.                     else:
  65.                         message = value.get('message', None)
  66.                 except ValueError:
  67.                     pass
  68.    
  69.         exception_class = ErrorInResponseException
  70.         if status in ErrorCode.NO_SUCH_ELEMENT:
  71.             exception_class = NoSuchElementException
  72.         elif status in ErrorCode.NO_SUCH_FRAME:
  73.             exception_class = NoSuchFrameException
  74.         elif status in ErrorCode.NO_SUCH_WINDOW:
  75.             exception_class = NoSuchWindowException
  76.         elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  77.             exception_class = StaleElementReferenceException
  78.         elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  79.             exception_class = ElementNotVisibleException
  80.         elif status in ErrorCode.INVALID_ELEMENT_STATE:
  81.             exception_class = InvalidElementStateException
  82.         elif status in ErrorCode.INVALID_SELECTOR \
  83.                 or status in ErrorCode.INVALID_XPATH_SELECTOR \
  84.                 or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  85.             exception_class = InvalidSelectorException
  86.         elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  87.             exception_class = ElementNotSelectableException
  88.         elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  89.             exception_class = ElementNotInteractableException
  90.         elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  91.             exception_class = InvalidCookieDomainException
  92.         elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  93.             exception_class = UnableToSetCookieException
  94.         elif status in ErrorCode.TIMEOUT:
  95.             exception_class = TimeoutException
  96.         elif status in ErrorCode.SCRIPT_TIMEOUT:
  97.             exception_class = TimeoutException
  98.         elif status in ErrorCode.UNKNOWN_ERROR:
  99.             exception_class = WebDriverException
  100.         elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  101.             exception_class = UnexpectedAlertPresentException
  102.         elif status in ErrorCode.NO_ALERT_OPEN:
  103.             exception_class = NoAlertPresentException
  104.         elif status in ErrorCode.IME_NOT_AVAILABLE:
  105.             exception_class = ImeNotAvailableException
  106.         elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  107.             exception_class = ImeActivationFailedException
  108.         elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  109.             exception_class = MoveTargetOutOfBoundsException
  110.         elif status in ErrorCode.JAVASCRIPT_ERROR:
  111.             exception_class = JavascriptException
  112.         elif status in ErrorCode.SESSION_NOT_CREATED:
  113.             exception_class = SessionNotCreatedException
  114.         elif status in ErrorCode.INVALID_ARGUMENT:
  115.             exception_class = InvalidArgumentException
  116.         elif status in ErrorCode.NO_SUCH_COOKIE:
  117.             exception_class = NoSuchCookieException
  118.         elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  119.             exception_class = ScreenshotException
  120.         elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  121.             exception_class = ElementClickInterceptedException
  122.         elif status in ErrorCode.INSECURE_CERTIFICATE:
  123.             exception_class = InsecureCertificateException
  124.         elif status in ErrorCode.INVALID_COORDINATES:
  125.             exception_class = InvalidCoordinatesException
  126.         elif status in ErrorCode.INVALID_SESSION_ID:
  127.             exception_class = InvalidSessionIdException
  128.         elif status in ErrorCode.UNKNOWN_METHOD:
  129.             exception_class = UnknownMethodException
  130.         else:
  131.             exception_class = WebDriverException
  132.         if value == '' or value is None:
  133.             value = response['value']
  134.         if isinstance(value, basestring):
  135.             if exception_class == ErrorInResponseException:
  136.                 raise exception_class(response, value)
  137.             raise exception_class(value)
  138.         if message == "" and 'message' in value:
  139.             message = value['message']
  140.    
  141.         screen = None
  142.         if 'screen' in value:
  143.             screen = value['screen']
  144.    
  145.         stacktrace = None
  146.         if 'stackTrace' in value and value['stackTrace']:
  147.             stacktrace = []
  148.             try:
  149.                 for frame in value['stackTrace']:
  150.                     line = self._value_or_default(frame, 'lineNumber', '')
  151.                     file = self._value_or_default(frame, 'fileName', '<anonymous>')
  152.                     if line:
  153.                         file = "%s:%s" % (file, line)
  154.                     meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  155.                     if 'className' in frame:
  156.                         meth = "%s.%s" % (frame['className'], meth)
  157.                     msg = "    at %s (%s)"
  158.                     msg = msg % (meth, file)
  159.                     stacktrace.append(msg)
  160.             except TypeError:
  161.                 pass
  162.         if exception_class == ErrorInResponseException:
  163.             raise exception_class(response, message)
  164.         elif exception_class == UnexpectedAlertPresentException:
  165.             alert_text = None
  166.             if 'data' in value:
  167.                 alert_text = value['data'].get('text')
  168.             elif 'alert' in value:
  169.                 alert_text = value['alert'].get('text')
  170.             raise exception_class(message, screen, stacktrace, alert_text)
  171. >       raise exception_class(message, screen, stacktrace)
  172. E       selenium.common.exceptions.WebDriverException: Message: Session timed out or not found
  173.  
  174. /opt/hostedtoolcache/Python/3.9.1/x64/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
  175. =========================== short test summary info ============================
  176. FAILED test.py::test_title - selenium.common.exceptions.WebDriverException: M...
  177. ============================== 1 failed in 11.72s ==============================
  178. Error: Process completed with exit code 1.
Advertisement
Add Comment
Please, Sign In to add comment