Skip to content

[🐛 Bug]: Fairly meaningless backtrace information is added at the expense of backtrace locations. #13221

Closed
@ioquatix

Description

@ioquatix

What happened?

This line of code here:

ex.set_backtrace(backtrace + ex.backtrace)
causes Exception#backtrace_locations to return nil.

This is problematic for test frameworks that use the detailed information in backtrace_locations to format errors more effectively.

In addition, the actual information that is added to the backtrace seems less than useful.

I understand the intention of this "feature" but I think significantly more is lost than is gained by including the backtrace from the web server. At present, this is causing my test harness to blow up as it expects backtrace_locations to at least not be nil.

How can we reproduce the issue?

Any code that triggers an error from the Chrome browser, e.g. finding an element that doesn't exist.

Relevant log output

irb(Sus::Output::Backtrace):002:0> exception.backtrace
=> 
["#0 0x555f3355f6d4 <unknown>",                                              
 "#1 0x555f33264187 <unknown>",                                              
 "#2 0x555f332a2717 <unknown>",                                              
 "#3 0x555f332cc132 <unknown>",                                              
 "#4 0x555f332a042a <unknown>",                                              
 "#5 0x555f332cc3ae <unknown>",                                              
 "#6 0x555f332e2f65 <unknown>",                                              
 "#7 0x555f332cbed3 <unknown>",                                              
 "#8 0x555f3329e420 <unknown>",                                              
 "#9 0x555f3329fa93 <unknown>",                                              
 "#10 0x555f335324c0 <unknown>",                                             
 "#11 0x555f33535780 <unknown>",                                             
 "#12 0x555f335351fa <unknown>",                                             
 "#13 0x555f33535c95 <unknown>",                                             
 "#14 0x555f3352465b <unknown>",
 "#15 0x555f33536080 <unknown>",
 "#16 0x555f3350f830 <unknown>",
 "#17 0x555f3354fee7 <unknown>",
 "#18 0x555f335500f5 <unknown>",
 "#19 0x555f3355ecce <unknown>",
 "#20 0x7fae7a6aa9eb <unknown>",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/response.rb:55:in `assert_ok'",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/response.rb:34:in `initialize'",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/http/common.rb:83:in `new'",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/http/common.rb:83:in `create_response'",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/http/default.rb:103:in `request'",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/http/common.rb:59:in `call'",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/bridge.rb:601:in `execute'",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/bridge.rb:400:in `clear_element'",
 "/home/samuel/.gem/ruby/3.2.2/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/common/element.rb:223:in `clear'",
 "/home/samuel/Projects/oriontransfer/socketry.io/fixtures/website_context.rb:96:in `fill_in'",
 "test/pages/customer.rb:30:in `block (3 levels) in <top (required)>'",
 "/home/samuel/.gem/ruby/3.2.2/gems/sus-0.23.0/lib/sus/it.rb:50:in `block in handle_skip'",
 "/home/samuel/.gem/ruby/3.2.2/gems/sus-0.23.0/lib/sus/it.rb:49:in `catch'",
 "/home/samuel/.gem/ruby/3.2.2/gems/sus-0.23.0/lib/sus/it.rb:49:in `handle_skip'",
 "/home/samuel/.gem/ruby/3.2.2/gems/sus-0.23.0/lib/sus/it.rb:43:in `block (2 levels) in call'",
 "/home/samuel/.gem/ruby/3.2.2/gems/sus-0.23.0/lib/sus/base.rb:28:in `around'",
 "/home/samuel/.gem/ruby/3.2.2/gems/sus-fixtures-async-0.1.2/lib/sus/fixtures/async/reactor_context.rb:69:in `block (2 levels) in around'",
 "/home/samuel/.gem/ruby/3.2.2/gems/sus-fixtures-async-0.1.2/lib/sus/fixtures/async/reactor_context.rb:36:in `block in run_with_timeout'",
 "/home/samuel/.gem/ruby/3.2.2/gems/async-2.6.5/lib/async/task.rb:160:in `block in run'",
 "/home/samuel/.gem/ruby/3.2.2/gems/async-2.6.5/lib/async/task.rb:330:in `block in schedule'"]
irb(Sus::Output::Backtrace):003:0> exception.backtrace_locations
=> nil

Operating System

Arch Linux

Selenium version

Ruby selenium-webdriver-4.15.0

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

Chromium 119.0.6045.159 Arch Linux

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

ChromeDriver 119.0.6045.159 (eaa767197fa7dd412133d1b84f7eb60da43409c9-refs/branch-heads/6045@{#1327})

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-rbRuby BindingsI-defectSomething is not working as intendedR-help wantedIssues looking for contributions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions