Skip to content

Conversation

cgoldberg
Copy link
Member

@cgoldberg cgoldberg commented Oct 2, 2025

User description

🔗 Related Issues

#16309

💥 What does this PR do?

This PR fixes a breaking change to the Chromium class __init__ signature inadvertently introduced in #16309. Defaults of None are re-added back as keyword argument defaults for browser_name and vendor_prefix.

🔄 Types of changes

  • Bug fix (backwards compatible)

PR Type

Bug fix


Description

  • Re-add None defaults for browser_name and vendor_prefix parameters

  • Fix breaking change in ChromiumDriver __init__ signature

  • Restore backwards compatibility for Chromium class initialization


Diagram Walkthrough

flowchart LR
  A["ChromiumDriver.__init__"] --> B["browser_name: Optional[str] = None"]
  A --> C["vendor_prefix: Optional[str] = None"]
  B --> D["Backwards Compatible"]
  C --> D
Loading

File Walkthrough

Relevant files
Bug fix
webdriver.py
Restore default parameter values in ChromiumDriver constructor

py/selenium/webdriver/chromium/webdriver.py

  • Changed browser_name parameter from required str to optional with None
    default
  • Changed vendor_prefix parameter from required str to optional with
    None default
  • Added Optional type hints for both parameters
+2/-2     

@selenium-ci selenium-ci added the C-py Python Bindings label Oct 2, 2025
Copy link
Contributor

qodo-merge-pro bot commented Oct 2, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Copy link
Contributor

qodo-merge-pro bot commented Oct 2, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Handle None for optional parameters

To prevent potential runtime errors, assign default string values to
browser_name and vendor_prefix if they are None.

py/selenium/webdriver/chromium/webdriver.py [32-52]

 def __init__(
     self,
     browser_name: Optional[str] = None,
     vendor_prefix: Optional[str] = None,
     options: Optional[ChromiumOptions] = None,
     service: Optional[ChromiumService] = None,
     keep_alive: bool = True,
 ) -> None:
     """Creates a new WebDriver instance of the ChromiumDriver. Starts the
     service and then creates new WebDriver instance of ChromiumDriver.
 
     :Args:
      - browser_name - Browser name used when matching capabilities.
      - vendor_prefix - Company prefix to apply to vendor-specific WebDriver extension commands.
      - options - this takes an instance of ChromiumOptions
      - service - Service object for handling the browser driver if you need to pass extra details
      - keep_alive - Whether to configure ChromiumRemoteConnection to use HTTP keep-alive.
     """
+    browser_name = browser_name or "chromium"
+    vendor_prefix = vendor_prefix or "goog"
 
     self.service = service if service else ChromiumService()
     options = options if options else ChromiumOptions()
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a potential runtime error from passing None to downstream logic that expects a string, and provides a sensible fix by assigning default values.

Medium
  • More

@cgoldberg
Copy link
Member Author

The only failure in CI is from Java and unrelated to these changes.

@cgoldberg cgoldberg merged commit 01a5e7b into SeleniumHQ:trunk Oct 2, 2025
18 of 19 checks passed
@cgoldberg cgoldberg deleted the py-fix-chromium-kwargs branch October 2, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants