magneat

https://www.w3docs.com/ bug

Feb 14th, 2021 (edited)
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 13.49 KB | None | 0 0
  1. (selenium_env) kytyt@kytyt:/media/kytyt/Linux DATA/programming/python/selenium_OLD/page_object2$ pytest -v -s test_other_pages.py
  2. ================================================== test session starts ===================================================
  3. platform linux -- Python 3.8.5, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
  4. cachedir: .pytest_cache
  5. rootdir: /media/kytyt/Linux DATA/programming/python/selenium_OLD/page_object2
  6. collected 1 item                                                                                                                  
  7.  
  8. test_other_pages.py::test_guest_can_click_element_below
  9. + located element "a.quiz-card:nth-child(1)"
  10. + scrolled into view "<selenium.webdriver.firefox.webelement.FirefoxWebElement (session="eef220d7-2e7c-4073-813b-11c64a6ace86", element="286f28aa-86b8-45dd-a760-711eb70fe721")>"
  11. FAILED
  12. stop driver
  13.  
  14.  
  15. ======================================================== FAILURES ========================================================
  16. ________________________________________________ test_guest_can_click_element_below ________________________________________________
  17.  
  18. self = <page_object2.pages.w3docs.OtherPages object at 0x7f53d3a14ee0>, how = 'css selector', what = 'a.quiz-card:nth-child(1)'
  19.  
  20.     def click_element_my(self, how, what):
  21.         element = self.locate_element_my(how, what)
  22.         self.scroll_into_view_my(element)
  23.         sleep(3)
  24.         try:
  25. >           element.click()
  26.  
  27. pages/base_page.py:41:
  28. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  29.  
  30. self = <selenium.webdriver.firefox.webelement.FirefoxWebElement (session="eef220d7-2e7c-4073-813b-11c64a6ace86", element="286f28aa-86b8-45dd-a760-711eb70fe721")>
  31.  
  32.     def click(self):
  33.         """Clicks the element."""
  34. >       self._execute(Command.CLICK_ELEMENT)
  35.  
  36. /home/kytyt/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py:80:
  37. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  38.  
  39. self = <selenium.webdriver.firefox.webelement.FirefoxWebElement (session="eef220d7-2e7c-4073-813b-11c64a6ace86", element="286f28aa-86b8-45dd-a760-711eb70fe721")>
  40. command = 'clickElement'
  41. params = {'id': '286f28aa-86b8-45dd-a760-711eb70fe721', 'sessionId': 'eef220d7-2e7c-4073-813b-11c64a6ace86'}
  42.  
  43.     def _execute(self, command, params=None):
  44.         """Executes a command against the underlying HTML element.
  45.    
  46.        Args:
  47.          command: The name of the command to _execute as a string.
  48.          params: A dictionary of named parameters to send with the command.
  49.    
  50.        Returns:
  51.          The command's JSON response loaded into a dictionary object.
  52.        """
  53.         if not params:
  54.             params = {}
  55.         params['id'] = self._id
  56. >       return self._parent.execute(command, params)
  57.  
  58. /home/kytyt/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py:633:
  59. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  60.  
  61. self = <selenium.webdriver.firefox.webdriver.WebDriver (session="eef220d7-2e7c-4073-813b-11c64a6ace86")>
  62. driver_command = 'clickElement', params = {'id': '286f28aa-86b8-45dd-a760-711eb70fe721'}
  63.  
  64.     def execute(self, driver_command, params=None):
  65.         """
  66.        Sends a command to be executed by a command.CommandExecutor.
  67.    
  68.        :Args:
  69.         - driver_command: The name of the command to execute as a string.
  70.         - params: A dictionary of named parameters to send with the command.
  71.    
  72.        :Returns:
  73.          The command's JSON response loaded into a dictionary object.
  74.        """
  75.         if self.session_id is not None:
  76.             if not params:
  77.                 params = {'sessionId': self.session_id}
  78.             elif 'sessionId' not in params:
  79.                 params['sessionId'] = self.session_id
  80.    
  81.         params = self._wrap_value(params)
  82.         response = self.command_executor.execute(driver_command, params)
  83.         if response:
  84. >           self.error_handler.check_response(response)
  85.  
  86. /home/kytyt/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:321:
  87. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  88.  
  89. self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f53d3a14fa0>
  90. response = {'status': 400, 'value': '{"value":{"error":"element click intercepted","message":"Element <a class=\\"quiz-card small...CommandsChild.jsm:199:24\\nreceiveMessage@chrome://marionette/content/actors/MarionetteCommandsChild.jsm:100:31\\n"}}'}
  91.  
  92.     def check_response(self, response):
  93.         """
  94.        Checks that a JSON response from the WebDriver does not have an error.
  95.    
  96.        :Args:
  97.         - response - The JSON response from the WebDriver server as a dictionary
  98.           object.
  99.    
  100.        :Raises: If the response contains an error message.
  101.        """
  102.         status = response.get('status', None)
  103.         if status is None or status == ErrorCode.SUCCESS:
  104.             return
  105.         value = None
  106.         message = response.get("message", "")
  107.         screen = response.get("screen", "")
  108.         stacktrace = None
  109.         if isinstance(status, int):
  110.             value_json = response.get('value', None)
  111.             if value_json and isinstance(value_json, basestring):
  112.                 import json
  113.                 try:
  114.                     value = json.loads(value_json)
  115.                     if len(value.keys()) == 1:
  116.                         value = value['value']
  117.                     status = value.get('error', None)
  118.                     if status is None:
  119.                         status = value["status"]
  120.                         message = value["value"]
  121.                         if not isinstance(message, basestring):
  122.                             value = message
  123.                             message = message.get('message')
  124.                     else:
  125.                         message = value.get('message', None)
  126.                 except ValueError:
  127.                     pass
  128.    
  129.         exception_class = ErrorInResponseException
  130.         if status in ErrorCode.NO_SUCH_ELEMENT:
  131.             exception_class = NoSuchElementException
  132.         elif status in ErrorCode.NO_SUCH_FRAME:
  133.             exception_class = NoSuchFrameException
  134.         elif status in ErrorCode.NO_SUCH_WINDOW:
  135.             exception_class = NoSuchWindowException
  136.         elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
  137.             exception_class = StaleElementReferenceException
  138.         elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
  139.             exception_class = ElementNotVisibleException
  140.         elif status in ErrorCode.INVALID_ELEMENT_STATE:
  141.             exception_class = InvalidElementStateException
  142.         elif status in ErrorCode.INVALID_SELECTOR \
  143.                 or status in ErrorCode.INVALID_XPATH_SELECTOR \
  144.                 or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
  145.             exception_class = InvalidSelectorException
  146.         elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
  147.             exception_class = ElementNotSelectableException
  148.         elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
  149.             exception_class = ElementNotInteractableException
  150.         elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
  151.             exception_class = InvalidCookieDomainException
  152.         elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
  153.             exception_class = UnableToSetCookieException
  154.         elif status in ErrorCode.TIMEOUT:
  155.             exception_class = TimeoutException
  156.         elif status in ErrorCode.SCRIPT_TIMEOUT:
  157.             exception_class = TimeoutException
  158.         elif status in ErrorCode.UNKNOWN_ERROR:
  159.             exception_class = WebDriverException
  160.         elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
  161.             exception_class = UnexpectedAlertPresentException
  162.         elif status in ErrorCode.NO_ALERT_OPEN:
  163.             exception_class = NoAlertPresentException
  164.         elif status in ErrorCode.IME_NOT_AVAILABLE:
  165.             exception_class = ImeNotAvailableException
  166.         elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
  167.             exception_class = ImeActivationFailedException
  168.         elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
  169.             exception_class = MoveTargetOutOfBoundsException
  170.         elif status in ErrorCode.JAVASCRIPT_ERROR:
  171.             exception_class = JavascriptException
  172.         elif status in ErrorCode.SESSION_NOT_CREATED:
  173.             exception_class = SessionNotCreatedException
  174.         elif status in ErrorCode.INVALID_ARGUMENT:
  175.             exception_class = InvalidArgumentException
  176.         elif status in ErrorCode.NO_SUCH_COOKIE:
  177.             exception_class = NoSuchCookieException
  178.         elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
  179.             exception_class = ScreenshotException
  180.         elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
  181.             exception_class = ElementClickInterceptedException
  182.         elif status in ErrorCode.INSECURE_CERTIFICATE:
  183.             exception_class = InsecureCertificateException
  184.         elif status in ErrorCode.INVALID_COORDINATES:
  185.             exception_class = InvalidCoordinatesException
  186.         elif status in ErrorCode.INVALID_SESSION_ID:
  187.             exception_class = InvalidSessionIdException
  188.         elif status in ErrorCode.UNKNOWN_METHOD:
  189.             exception_class = UnknownMethodException
  190.         else:
  191.             exception_class = WebDriverException
  192.         if value == '' or value is None:
  193.             value = response['value']
  194.         if isinstance(value, basestring):
  195.             if exception_class == ErrorInResponseException:
  196.                 raise exception_class(response, value)
  197.             raise exception_class(value)
  198.         if message == "" and 'message' in value:
  199.             message = value['message']
  200.    
  201.         screen = None
  202.         if 'screen' in value:
  203.             screen = value['screen']
  204.    
  205.         stacktrace = None
  206.         if 'stackTrace' in value and value['stackTrace']:
  207.             stacktrace = []
  208.             try:
  209.                 for frame in value['stackTrace']:
  210.                     line = self._value_or_default(frame, 'lineNumber', '')
  211.                     file = self._value_or_default(frame, 'fileName', '<anonymous>')
  212.                     if line:
  213.                         file = "%s:%s" % (file, line)
  214.                     meth = self._value_or_default(frame, 'methodName', '<anonymous>')
  215.                     if 'className' in frame:
  216.                         meth = "%s.%s" % (frame['className'], meth)
  217.                     msg = "    at %s (%s)"
  218.                     msg = msg % (meth, file)
  219.                     stacktrace.append(msg)
  220.             except TypeError:
  221.                 pass
  222.         if exception_class == ErrorInResponseException:
  223.             raise exception_class(response, message)
  224.         elif exception_class == UnexpectedAlertPresentException:
  225.             alert_text = None
  226.             if 'data' in value:
  227.                 alert_text = value['data'].get('text')
  228.             elif 'alert' in value:
  229.                 alert_text = value['alert'].get('text')
  230.             raise exception_class(message, screen, stacktrace, alert_text)
  231. >       raise exception_class(message, screen, stacktrace)
  232. E       selenium.common.exceptions.ElementClickInterceptedException: Message: Element <a class="quiz-card small-card" href="/quiz-start/html-basic"> is not clickable at point (154,50) because another element <a class="navbar-brand navbar-logo" href="/"> obscures it
  233.  
  234. /home/kytyt/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py:242: ElementClickInterceptedException
  235.  
  236. During handling of the above exception, another exception occurred:
  237.  
  238. driver = <selenium.webdriver.firefox.webdriver.WebDriver (session="eef220d7-2e7c-4073-813b-11c64a6ace86")>
  239.  
  240.     def test_guest_can_click_element_below(driver):
  241.         obj2 = OtherPages(driver, urls.W3DocsUrls.main_page)
  242.         obj2.open_url()
  243. >       obj2.click_element_below()
  244.  
  245. test_other_pages.py:8:
  246. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  247. pages/w3docs.py:18: in click_element_below
  248.     self.click_element_my(*PageWithButtons.BTN_BELOW_CSS_SELECTOR)
  249. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  250.  
  251. self = <page_object2.pages.w3docs.OtherPages object at 0x7f53d3a14ee0>, how = 'css selector', what = 'a.quiz-card:nth-child(1)'
  252.  
  253.     def click_element_my(self, how, what):
  254.         element = self.locate_element_my(how, what)
  255.         self.scroll_into_view_my(element)
  256.         sleep(3)
  257.         try:
  258.             element.click()
  259.         except ElementClickInterceptedException:
  260. >           raise ElementClickInterceptedException('Something is in the way of clicking')
  261. E           selenium.common.exceptions.ElementClickInterceptedException: Message: Something is in the way of clicking
  262.  
  263. pages/base_page.py:43: ElementClickInterceptedException
  264. ================================================ short test summary info =================================================
  265. FAILED test_other_pages.py::test_guest_can_click_element_below - selenium.common.exceptions.ElementClickInterceptedException: Mes...
  266. =================================================== 1 failed in 9.11s ====================================================
Add Comment
Please, Sign In to add comment