Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (selenium_env) kytyt@kytyt:/media/kytyt/Linux DATA/programming/python/selenium_OLD/page_object2$ pytest -v -s test_other_pages.py
- ================================================== test session starts ===================================================
- platform linux -- Python 3.8.5, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
- cachedir: .pytest_cache
- rootdir: /media/kytyt/Linux DATA/programming/python/selenium_OLD/page_object2
- collected 1 item
- test_other_pages.py::test_guest_can_click_element_below
- + located element "a.quiz-card:nth-child(1)"
- + scrolled into view "<selenium.webdriver.firefox.webelement.FirefoxWebElement (session="eef220d7-2e7c-4073-813b-11c64a6ace86", element="286f28aa-86b8-45dd-a760-711eb70fe721")>"
- FAILED
- stop driver
- ======================================================== FAILURES ========================================================
- ________________________________________________ test_guest_can_click_element_below ________________________________________________
- self = <page_object2.pages.w3docs.OtherPages object at 0x7f53d3a14ee0>, how = 'css selector', what = 'a.quiz-card:nth-child(1)'
- def click_element_my(self, how, what):
- element = self.locate_element_my(how, what)
- self.scroll_into_view_my(element)
- sleep(3)
- try:
- > element.click()
- pages/base_page.py:41:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <selenium.webdriver.firefox.webelement.FirefoxWebElement (session="eef220d7-2e7c-4073-813b-11c64a6ace86", element="286f28aa-86b8-45dd-a760-711eb70fe721")>
- def click(self):
- """Clicks the element."""
- > self._execute(Command.CLICK_ELEMENT)
- /home/kytyt/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py:80:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <selenium.webdriver.firefox.webelement.FirefoxWebElement (session="eef220d7-2e7c-4073-813b-11c64a6ace86", element="286f28aa-86b8-45dd-a760-711eb70fe721")>
- command = 'clickElement'
- params = {'id': '286f28aa-86b8-45dd-a760-711eb70fe721', 'sessionId': 'eef220d7-2e7c-4073-813b-11c64a6ace86'}
- def _execute(self, command, params=None):
- """Executes a command against the underlying HTML element.
- Args:
- command: The name of the command to _execute as a string.
- params: A dictionary of named parameters to send with the command.
- Returns:
- The command's JSON response loaded into a dictionary object.
- """
- if not params:
- params = {}
- params['id'] = self._id
- > return self._parent.execute(command, params)
- /home/kytyt/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webelement.py:633:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <selenium.webdriver.firefox.webdriver.WebDriver (session="eef220d7-2e7c-4073-813b-11c64a6ace86")>
- driver_command = 'clickElement', params = {'id': '286f28aa-86b8-45dd-a760-711eb70fe721'}
- def execute(self, driver_command, params=None):
- """
- Sends a command to be executed by a command.CommandExecutor.
- :Args:
- - driver_command: The name of the command to execute as a string.
- - params: A dictionary of named parameters to send with the command.
- :Returns:
- The command's JSON response loaded into a dictionary object.
- """
- if self.session_id is not None:
- if not params:
- params = {'sessionId': self.session_id}
- elif 'sessionId' not in params:
- params['sessionId'] = self.session_id
- params = self._wrap_value(params)
- response = self.command_executor.execute(driver_command, params)
- if response:
- > self.error_handler.check_response(response)
- /home/kytyt/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:321:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f53d3a14fa0>
- 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"}}'}
- def check_response(self, response):
- """
- Checks that a JSON response from the WebDriver does not have an error.
- :Args:
- - response - The JSON response from the WebDriver server as a dictionary
- object.
- :Raises: If the response contains an error message.
- """
- status = response.get('status', None)
- if status is None or status == ErrorCode.SUCCESS:
- return
- value = None
- message = response.get("message", "")
- screen = response.get("screen", "")
- stacktrace = None
- if isinstance(status, int):
- value_json = response.get('value', None)
- if value_json and isinstance(value_json, basestring):
- import json
- try:
- value = json.loads(value_json)
- if len(value.keys()) == 1:
- value = value['value']
- status = value.get('error', None)
- if status is None:
- status = value["status"]
- message = value["value"]
- if not isinstance(message, basestring):
- value = message
- message = message.get('message')
- else:
- message = value.get('message', None)
- except ValueError:
- pass
- exception_class = ErrorInResponseException
- if status in ErrorCode.NO_SUCH_ELEMENT:
- exception_class = NoSuchElementException
- elif status in ErrorCode.NO_SUCH_FRAME:
- exception_class = NoSuchFrameException
- elif status in ErrorCode.NO_SUCH_WINDOW:
- exception_class = NoSuchWindowException
- elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
- exception_class = StaleElementReferenceException
- elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
- exception_class = ElementNotVisibleException
- elif status in ErrorCode.INVALID_ELEMENT_STATE:
- exception_class = InvalidElementStateException
- elif status in ErrorCode.INVALID_SELECTOR \
- or status in ErrorCode.INVALID_XPATH_SELECTOR \
- or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
- exception_class = InvalidSelectorException
- elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
- exception_class = ElementNotSelectableException
- elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
- exception_class = ElementNotInteractableException
- elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
- exception_class = InvalidCookieDomainException
- elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
- exception_class = UnableToSetCookieException
- elif status in ErrorCode.TIMEOUT:
- exception_class = TimeoutException
- elif status in ErrorCode.SCRIPT_TIMEOUT:
- exception_class = TimeoutException
- elif status in ErrorCode.UNKNOWN_ERROR:
- exception_class = WebDriverException
- elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
- exception_class = UnexpectedAlertPresentException
- elif status in ErrorCode.NO_ALERT_OPEN:
- exception_class = NoAlertPresentException
- elif status in ErrorCode.IME_NOT_AVAILABLE:
- exception_class = ImeNotAvailableException
- elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
- exception_class = ImeActivationFailedException
- elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
- exception_class = MoveTargetOutOfBoundsException
- elif status in ErrorCode.JAVASCRIPT_ERROR:
- exception_class = JavascriptException
- elif status in ErrorCode.SESSION_NOT_CREATED:
- exception_class = SessionNotCreatedException
- elif status in ErrorCode.INVALID_ARGUMENT:
- exception_class = InvalidArgumentException
- elif status in ErrorCode.NO_SUCH_COOKIE:
- exception_class = NoSuchCookieException
- elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
- exception_class = ScreenshotException
- elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
- exception_class = ElementClickInterceptedException
- elif status in ErrorCode.INSECURE_CERTIFICATE:
- exception_class = InsecureCertificateException
- elif status in ErrorCode.INVALID_COORDINATES:
- exception_class = InvalidCoordinatesException
- elif status in ErrorCode.INVALID_SESSION_ID:
- exception_class = InvalidSessionIdException
- elif status in ErrorCode.UNKNOWN_METHOD:
- exception_class = UnknownMethodException
- else:
- exception_class = WebDriverException
- if value == '' or value is None:
- value = response['value']
- if isinstance(value, basestring):
- if exception_class == ErrorInResponseException:
- raise exception_class(response, value)
- raise exception_class(value)
- if message == "" and 'message' in value:
- message = value['message']
- screen = None
- if 'screen' in value:
- screen = value['screen']
- stacktrace = None
- if 'stackTrace' in value and value['stackTrace']:
- stacktrace = []
- try:
- for frame in value['stackTrace']:
- line = self._value_or_default(frame, 'lineNumber', '')
- file = self._value_or_default(frame, 'fileName', '<anonymous>')
- if line:
- file = "%s:%s" % (file, line)
- meth = self._value_or_default(frame, 'methodName', '<anonymous>')
- if 'className' in frame:
- meth = "%s.%s" % (frame['className'], meth)
- msg = " at %s (%s)"
- msg = msg % (meth, file)
- stacktrace.append(msg)
- except TypeError:
- pass
- if exception_class == ErrorInResponseException:
- raise exception_class(response, message)
- elif exception_class == UnexpectedAlertPresentException:
- alert_text = None
- if 'data' in value:
- alert_text = value['data'].get('text')
- elif 'alert' in value:
- alert_text = value['alert'].get('text')
- raise exception_class(message, screen, stacktrace, alert_text)
- > raise exception_class(message, screen, stacktrace)
- 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
- /home/kytyt/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py:242: ElementClickInterceptedException
- During handling of the above exception, another exception occurred:
- driver = <selenium.webdriver.firefox.webdriver.WebDriver (session="eef220d7-2e7c-4073-813b-11c64a6ace86")>
- def test_guest_can_click_element_below(driver):
- obj2 = OtherPages(driver, urls.W3DocsUrls.main_page)
- obj2.open_url()
- > obj2.click_element_below()
- test_other_pages.py:8:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- pages/w3docs.py:18: in click_element_below
- self.click_element_my(*PageWithButtons.BTN_BELOW_CSS_SELECTOR)
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <page_object2.pages.w3docs.OtherPages object at 0x7f53d3a14ee0>, how = 'css selector', what = 'a.quiz-card:nth-child(1)'
- def click_element_my(self, how, what):
- element = self.locate_element_my(how, what)
- self.scroll_into_view_my(element)
- sleep(3)
- try:
- element.click()
- except ElementClickInterceptedException:
- > raise ElementClickInterceptedException('Something is in the way of clicking')
- E selenium.common.exceptions.ElementClickInterceptedException: Message: Something is in the way of clicking
- pages/base_page.py:43: ElementClickInterceptedException
- ================================================ short test summary info =================================================
- FAILED test_other_pages.py::test_guest_can_click_element_below - selenium.common.exceptions.ElementClickInterceptedException: Mes...
- =================================================== 1 failed in 9.11s ====================================================
Add Comment
Please, Sign In to add comment