[py] Re-add defaults for Chromium kwargs by cgoldberg · Pull Request #16372 · SeleniumHQ/selenium
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
Handle None for optional parametersTo prevent potential runtime errors, assign default string values to 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()
Suggestion importance[1-10]: 8__ Why: The suggestion correctly identifies a potential runtime error from passing | Medium |
| ||