Skip to content

Selenium 4 exceptions produce a Traceback that contains this superfluous 'Backtrace' info.  #9977

Closed

Description

@PatrickFlaherty

What happened?

Selenium 4 exceptions produce a Traceback that contains superfluous 'Backtrace' information that is not useful for ordinary debugging as the Traceback already contains the traditional call stack information.

How can we reproduce the issue?

Create an exception that produces a ElementClickInterceptedException

   def webwait_rl(self, locator_type, locator_value, condition=EC.element_to_be_clickable, wait=wait_default):
        try:
            result = WebDriverWait(self.browser, wait).until(condition((self.locator_map[locator_type], locator_value)))
            return result
        except Exception as e:
            raise AssertionError("\n\n%s\nwebwait_rl exception %s\n%r\nlocator: %s=%s   wait: %d   condition: %s\n%s"
                                 % (self.output_stack(ss), e, self.e_type(e), locator_type, locator_value, wait,
                                    condition, msg))

Relevant log output

Selenium 3.141.0
FAILED (failures=1)
FailureTraceback (most recent call last):
  File "C:\Users\pflaherty\pycharmprojects\automation-master\Live\RCV_Guardian\RcvGuardian_Tip.py", line 247, in test_001_create_guardian_eyewitness_tip
    rcv_main.close_module_by_name("SAFETY_PROFILE")
  File "C:\Users\pflaherty\pycharmprojects\automation-master\RCV_Guardian_Pages\RcvGuardianMainPage.py", line 368, in close_module_by_name
    self.click_(x_query, retry=3, msg=f"Unable to click button to close the '{module_name}' module.")
  File "C:\Users\pflaherty\pycharmprojects\automation-master\PageObject\AWDTools.py", line 293, in click_
    (msg, locator, i, self.output_stack(), ex))
AssertionError: Unable to click button to close the 'SAFETY_PROFILE' module.
click_ failed using locator xpath=//*[@smartlettype='SAFETY_PROFILE']//div[@class='action smartletClose']/a after 3 retries
test_001_create_guardian_eyewitness_tip--close_module_by_name--click_--491-3783
10-22-21  10:43:03AMElementClickInterceptedException('element click intercepted: Element <a>...</a> is not clickable at point (1321, 321). Other element would receive the click: <div id="chatConversation" class="textPosterTarget eyewitness">...</div>\n  (Session info: chrome=94.0.4606.81)', None, None)

Selenium 4.0
FAILED (failures=1)
FailureTraceback (most recent call last):
  File "C:\Users\pflaherty\pycharmprojects\automation-master\Live\RCV_Guardian\RcvGuardian_Tip.py", line 247, in test_001_create_guardian_eyewitness_tip
    rcv_main.close_module_by_name("SAFETY_PROFILE")
  File "C:\Users\pflaherty\pycharmprojects\automation-master\RCV_Guardian_Pages\RcvGuardianMainPage.py", line 368, in close_module_by_name
    self.click_(x_query, retry=3, msg=f"Unable to click button to close the '{module_name}' module.")
  File "C:\Users\pflaherty\pycharmprojects\automation-master\PageObject\AWDTools.py", line 293, in click_
    (msg, locator, i, self.output_stack(), ex))
AssertionError: Unable to click button to close the 'SAFETY_PROFILE' module.
click_ failed using locator xpath=//*[@smartlettype='SAFETY_PROFILE']//div[@class='action smartletClose']/a after 3 retries
test_001_create_guardian_eyewitness_tip--close_module_by_name--click_--491-3161
10-22-21  10:32:41AMElementClickInterceptedException('element click intercepted: Element <a>...</a> is not clickable at point (1321, 321). Other element would receive the click: <div id="chatConversation" class="textPosterTarget eyewitness">...</div>\n  (Session info: chrome=94.0.4606.81)', None, ['Backtrace:', '\tOrdinal0 [0x0080BDE3+2473443]', '\tOrdinal0 [0x007A6661+2057825]', '\tOrdinal0 [0x006B2438+1057848]', '\tOrdinal0 [0x006E27B9+1255353]', '\tOrdinal0 [0x006E0AE0+1247968]', '\tOrdinal0 [0x006DE8AD+1239213]', '\tOrdinal0 [0x006DD701+1234689]', '\tOrdinal0 [0x006D3567+1193319]', '\tOrdinal0 [0x006F56E3+1332963]', '\tOrdinal0 [0x006D3386+1192838]', '\tOrdinal0 [0x006F57CA+1333194]', '\tOrdinal0 [0x00704ABF+1395391]', '\tOrdinal0 [0x006F55AB+1332651]', '\tOrdinal0 [0x006D2104+1188100]', '\tOrdinal0 [0x006D2F59+1191769]', '\tGetHandleVerifier [0x00992266+1549718]', '\tGetHandleVerifier [0x00A3D4A7+2250711]', '\tGetHandleVerifier [0x0089718B+521403]', '\tGetHandleVerifier [0x00896229+517465]', '\tOrdinal0 [0x007AB79D+2078621]', '\tOrdinal0 [0x007AFB58+2095960]', '\tOrdinal0 [0x007AFC92+2096274]', '\tOrdinal0 [0x007B9541+2135361]', '\tBaseThreadInitThunk [0x7725FA29+25]', '\tRtlGetAppContainerNamedObjectPath [0x77A47A9E+286]', '\tRtlGetAppContainerNamedObjectPath [0x77A47A6E+238]', ''])

Operating System

Windows 10

Selenium version

4.0.0

What are the browser(s) and version(s) where you see this issue?

94.0.4606.81 (Official Build) (64-bit) (cohort: Stable)

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 94.0.4606.61

Are you using Selenium Grid?

No

Activity

  1. added
    I-defect
    A-needs-triaging
    on Oct 22, 2021
  2. github-actions commented on Oct 22, 2021

    @github-actions
    Contributor

    @PatrickFlaherty, thank you for creating this issue. We will troubleshoot it as soon as we can.


    Info for maintainers

    Triage this issue by using labels.

    If information is missing, add a helpful comment and then I-issue-template label.

    If the issue is a question, add the I-question label.

    If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

    After troubleshooting the issue, please add the R-awaiting answer label.

    Thank you!

  3. AutomatedTester commented on Oct 22, 2021

    @AutomatedTester
    Member

    This code has not changed in nearly forever. If it's the ordinal type messages that's coming from Chrome, they appear to have added extra info to this over the years.

  4. PatrickFlaherty commented on Oct 22, 2021

    @PatrickFlaherty
    Author
  5. diemol commented on Oct 22, 2021

    @diemol
    Member

    Can you provide a complete reproduction script? What if your caps are creating a JWP session with 3.141.0?

  6. added
    J-awaiting answer
    and removed
    A-needs-triaging
    on Oct 22, 2021
  7. PatrickFlaherty commented on Oct 22, 2021

    @PatrickFlaherty
    Author

    Python script:
    from selenium import webdriver
    from selenium.webdriver.support.ui import WebDriverWait

    Step 1) Open Chrome

    browser = webdriver.Chrome()

    Step 2) Navigate to Facebook

    browser.get("http://www.facebook.com")

    Step 3) Search & Enter the Email or Phone field & Enter Password

    username = browser.find_element("email")
    password = browser.find_element("pass")
    submit = browser.find_element("loginbutton")
    username.send_keys("YOUR EMAILID")
    password.send_keys("YOUR PASSWORD")

    Step 4) Click Login

    submit.click()
    wait = WebDriverWait(browser, 5)
    page_title = browser.title
    assert page_title == "Facebook"


    This produces the error: InvalidArgumentException: Message: invalid argument: invalid locator.
    This demonstrates the issue when run against selenium 3 and 4 and observing the exemption stack.

  8. diemol commented on Oct 22, 2021

    @diemol
    Member

    I believe some pieces are missed in the snippet from above. In addition, I do not have a test Facebook account to use it to run this example.

    Feel free to provide a complete code snippet we can copy & paste whenever time allows it. Thanks!

  9. PatrickFlaherty commented on Oct 22, 2021

    @PatrickFlaherty
    Author

    It never makes it to actually logging in to facebook in the demo script, it will fail before login.
    Please run as is and it should produce:
    InvalidArgumentException: Message: invalid argument: invalid locator.

  10. diemol commented on Oct 22, 2021

    @diemol
    Member

    Understood. So please add the proper locators to the script and then we can use it to see the issue.

  11. PatrickFlaherty commented on Oct 22, 2021

    @PatrickFlaherty
    Author

    Well, I think this script would work to demonstrate what I want to show you. Indeed the locators are bogus but can you run with Selenium 3 and 4 and see difference in the exception trace?

    I see this for Selenium 3:

    Traceback (most recent call last):
    File "C:/Users/pflaherty/pycharmprojects/automation-master/Live/RCV_Guardian/Selenium4_Exception_Example.py", line 8, in
    username = browser.find_element("email")
    File "C:\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
    'value': value})['value']
    File "C:\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
    File "C:\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid locator
    (Session info: chrome=94.0.4606.81)

    I see this for Selenium 4:

    Traceback (most recent call last):
    File "C:/Users/pflaherty/pycharmprojects/automation-master/Live/RCV_Guardian/Selenium4_Exception_Example.py", line 8, in
    username = browser.find_element("email")
    File "C:\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1240, in find_element
    'value': value})['value']
    File "C:\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 418, in execute
    self.error_handler.check_response(response)
    File "C:\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid locator
    (Session info: chrome=94.0.4606.81)
    Stacktrace:
    Backtrace:
    Ordinal0 [0x0080BDE3+2473443]
    Ordinal0 [0x007A6661+2057825]
    Ordinal0 [0x006B2438+1057848]
    Ordinal0 [0x006DC981+1231233]
    Ordinal0 [0x00706712+1402642]
    Ordinal0 [0x006F571A+1333018]
    Ordinal0 [0x00704ABF+1395391]
    Ordinal0 [0x006F55AB+1332651]
    Ordinal0 [0x006D2104+1188100]
    Ordinal0 [0x006D2F59+1191769]
    GetHandleVerifier [0x00992266+1549718]
    GetHandleVerifier [0x00A3D4A7+2250711]
    GetHandleVerifier [0x0089718B+521403]
    GetHandleVerifier [0x00896229+517465]
    Ordinal0 [0x007AB79D+2078621]
    Ordinal0 [0x007AFB58+2095960]
    Ordinal0 [0x007AFC92+2096274]
    Ordinal0 [0x007B9541+2135361]
    BaseThreadInitThunk [0x7725FA29+25]
    RtlGetAppContainerNamedObjectPath [0x77A47A9E+286]
    RtlGetAppContainerNamedObjectPath [0x77A47A6E+238]

    I hope this is enough, if not please let me know.

  12. PatrickFlaherty commented on Oct 26, 2021

    @PatrickFlaherty
    Author

    @diemol were you able to reproduce the issue? Thank you.

  13. added
    C-py
    on Nov 4, 2021
  14. AutomatedTester commented on Nov 5, 2021

    @AutomatedTester
    Member

    I can reproduce this. It looks like a bug around stacktraces being returned was fixed which made this appear to be incredibly verbose.

    I can hide some of the stack but only if the Googlers feel it's ok. I have raised https://bugs.chromium.org/p/chromedriver/issues/detail?id=3944

  15. PatrickFlaherty commented on Dec 1, 2021

    @PatrickFlaherty
    Author

    Does not seem there is any response to the chromedriver question posed. What can be done?

  16. titusfortner commented on Dec 26, 2021

    @titusfortner
    Member

    just don't have any failing tests? ;-P

    But there's nothing for this codebase to do, we don't want to go down the road of arbitrarily hiding exception messages returned by drivers.

  17. github-actions commented on Jan 26, 2022

    @github-actions
    Contributor

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  18. locked and limited conversation to collaborators on Jan 26, 2022
  19. added a commit that references this issue on Dec 29, 2024
    f859be1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-pyI-defectJ-awaiting answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions