-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[rb] output driver logs by default when debug is enabled #16901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds automatic debug logging to the Selenium WebDriver Ruby bindings by enabling verbose driver output when WebDriver.logger.debug? is true. The implementation modifies the service initialization for Chrome, Edge, Firefox, and IE drivers to automatically inject appropriate debug flags.
Changes:
- Override
initializemethod in Chrome, Edge, IE, and Firefox service classes to detect debug mode - Remove conflicting log-level arguments before adding debug flags
- Add appropriate verbose flags for each driver (--verbose for Chrome/Edge, -v for Firefox, --log-level=DEBUG for IE)
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| rb/lib/selenium/webdriver/chrome/service.rb | Add initialize override to inject --verbose flag when debug is enabled |
| rb/lib/selenium/webdriver/edge/service.rb | Add initialize override to inject --verbose flag when debug is enabled |
| rb/lib/selenium/webdriver/firefox/service.rb | Modify initialize to inject -v flag when debug is enabled |
| rb/lib/selenium/webdriver/ie/service.rb | Add initialize override to inject --log-level=DEBUG when debug is enabled |
| rb/sig/lib/selenium/webdriver/chrome/service.rbs | Add type signature for new initialize method |
| rb/sig/lib/selenium/webdriver/edge/service.rbs | Add type signature for new initialize method |
| rb/sig/lib/selenium/webdriver/ie/service.rbs | Add type signature for new initialize method |
| rb/spec/unit/selenium/webdriver/chrome/service_spec.rb | Stub debug? to return false in tests |
| rb/spec/unit/selenium/webdriver/edge/service_spec.rb | Stub debug? to return false in tests |
| rb/spec/unit/selenium/webdriver/firefox/service_spec.rb | Stub debug? to return false in tests, update test description |
| rb/spec/unit/selenium/webdriver/ie/service_spec.rb | Stub debug? to return false in tests |
| rb/spec/unit/selenium/webdriver/common/service_spec.rb | Stub debug? to return false, update Firefox test expectation |
| def initialize(args: nil, **) | ||
| if WebDriver.logger.debug? | ||
| args = Array(args.dup) | ||
| args.reject! { |arg| arg.include?('log-level') || arg.include?('silent') } | ||
| args << '--verbose' |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new debug logging behavior lacks test coverage. There should be tests that verify the service adds the verbose flag when WebDriver.logger.debug? returns true, and that it properly removes conflicting log-level arguments before adding the verbose flag.
| def initialize(args: nil, **) | ||
| if WebDriver.logger.debug? | ||
| args = Array(args.dup) | ||
| args.reject! { |arg| arg.include?('log-level') || arg.include?('silent') } | ||
| args << '--verbose' |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new debug logging behavior lacks test coverage. There should be tests that verify the service adds the verbose flag when WebDriver.logger.debug? returns true, and that it properly removes conflicting log-level arguments before adding the verbose flag.
| if WebDriver.logger.debug? | ||
| if (index = args.index('--log')) | ||
| args.delete_at(index) # delete '--log' | ||
| args.delete_at(index) # delete the value (now at same index) | ||
| elsif (index = args.index { |arg| arg.start_with?('--log=') }) | ||
| args.delete_at(index) | ||
| end | ||
| args << '-v' | ||
| end |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new debug logging behavior lacks test coverage. There should be tests that verify the service adds the -v flag when WebDriver.logger.debug? returns true, and that it properly removes conflicting --log arguments before adding the -v flag.
| def initialize(args: nil, **) | ||
| if WebDriver.logger.debug? | ||
| args = Array(args.dup) | ||
| args.reject! { |arg| arg.include?('log-level') || arg.include?('silent') } | ||
| args << '--log-level=DEBUG' | ||
| end |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new debug logging behavior lacks test coverage. There should be tests that verify the service adds the --log-level=DEBUG flag when WebDriver.logger.debug? returns true, and that it properly removes conflicting log-level arguments before adding the DEBUG flag.
User description
🔗 Related Issues
Similar to #16900
I actually thought Ruby already did this.
💥 What does this PR do?
WebDriver.logger.debug?adds driver log output to logger🔧 Implementation Notes
SE_DEBUG(the new behavior)PR Type
Enhancement
Description
Enable verbose driver logging when WebDriver debug mode is active
Add automatic log level configuration for Chrome, Edge, Firefox, IE
Remove conflicting log-level arguments before applying debug settings
Unify debug logging behavior across all supported browser drivers
Diagram Walkthrough
File Walkthrough
service.rb
Add verbose logging for Chrome when debug enabledrb/lib/selenium/webdriver/chrome/service.rb
initializemethod to check WebDriver debug status--log-levelarguments from args--verboseflag when debug mode is enabledservice.rb
Add verbose logging for Edge when debug enabledrb/lib/selenium/webdriver/edge/service.rb
initializemethod to check WebDriver debug status--log-levelarguments from args--verboseflag when debug mode is enabledservice.rb
Add debug logging for Firefox when debug enabledrb/lib/selenium/webdriver/firefox/service.rb
initializemethod with debug logging logic--logarguments and their values if present--log debugarguments when debug mode is enabledservice.rb
Add debug logging for IE when debug enabledrb/lib/selenium/webdriver/ie/service.rb
initializemethod to check WebDriver debug status--log-levelarguments from args--log-level=DEBUGflag when debug mode is enabled