Sitelet https://github.com/SeleniumHQ/selenium/pull/17557
Skip to content

[rb] deprecate Chromium Profile classes - #17557

Merged
aguspe merged 1 commit into
trunkfrom
profiles_rb
May 23, 2026
Merged

aguspe merged 1 commit into
trunkfrom
profiles_rb

Conversation

@titusfortner

Copy link
Copy Markdown
Member

I thought we'd already done this.

  • No other bindings still have these classes
  • The extensions methods no longer work
  • There's nothing here that can't be done with Options class
  • The integration tests we have are essentially unit tests

@selenium-ci selenium-ci added C-rb Ruby Bindings B-build Includes scripting, bazel and CI integrations labels May 23, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Deprecate Chromium Profile classes in Ruby bindings

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add deprecation warnings to Chromium Profile classes
• Warn users to migrate to Options class methods
• Remove obsolete Profile integration and unit tests
• Update build configuration to remove test references
Diagram
flowchart LR
  A["Chromium::Profile"] -->|deprecate| B["Use Options class"]
  C["Options profile kwarg"] -->|deprecate| B
  B -->|add_argument| D["--user-data-dir"]
  B -->|add_preference| E["Preferences"]
  B -->|add_extension| F["Extensions"]
  G["Remove Profile tests"] -->|cleanup| H["Build config"]

Loading

File Changes

1. rb/lib/selenium/webdriver/chromium/options.rb ✨ Enhancement +8/-0

Add deprecation warning for profile kwarg

• Add deprecation warning when profile: kwarg is used in Options initialization
• Direct users to use add_argument, add_preference, and add_extension methods instead
• Use deprecation ID :chromium_options_profile for tracking

rb/lib/selenium/webdriver/chromium/options.rb


2. rb/lib/selenium/webdriver/chromium/profile.rb ✨ Enhancement +6/-0

Add deprecation warning to Profile class

• Add deprecation warning in Profile class constructor
• Warn that Chromium::Profile, Chrome::Profile, and Edge::Profile are deprecated
• Direct users to Options class methods as alternatives
• Use deprecation ID :chromium_profile for tracking

rb/lib/selenium/webdriver/chromium/profile.rb


3. rb/spec/integration/selenium/webdriver/chrome/profile_spec.rb 🧪 Tests +0/-61

Remove Chrome Profile integration tests

• Remove entire integration test file for Chrome Profile class
• Tests covered extension addition, binary reading, and error handling
• Functionality now covered by Options class tests

rb/spec/integration/selenium/webdriver/chrome/profile_spec.rb


View more (4)
4. rb/spec/integration/selenium/webdriver/edge/profile_spec.rb 🧪 Tests +0/-60

Remove Edge Profile integration tests

• Remove entire integration test file for Edge Profile class
• Tests covered extension addition, binary reading, and error handling
• Functionality now covered by Options class tests

rb/spec/integration/selenium/webdriver/edge/profile_spec.rb


5. rb/spec/unit/selenium/webdriver/chrome/profile_spec.rb 🧪 Tests +0/-73

Remove Chrome Profile unit tests

• Remove entire unit test file for Chrome Profile class
• Tests covered preference setting, reading, and writing functionality
• Functionality now covered by Options class tests

rb/spec/unit/selenium/webdriver/chrome/profile_spec.rb


6. rb/spec/unit/selenium/webdriver/edge/profile_spec.rb 🧪 Tests +0/-73

Remove Edge Profile unit tests

• Remove entire unit test file for Edge Profile class
• Tests covered preference setting, reading, and writing functionality
• Functionality now covered by Options class tests

rb/spec/unit/selenium/webdriver/edge/profile_spec.rb


7. rb/spec/BUILD.bazel ⚙️ Configuration changes +0/-4

Update build config to remove Profile tests

• Remove Chrome Profile integration test target reference
• Remove Edge Profile integration test target reference
• Remove Chrome Profile unit test target reference
• Remove Edge Profile unit test target reference

rb/spec/BUILD.bazel


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1)

Grey Divider


Remediation recommended

1. Chrome/Edge Profile tests removed 📘 Rule violation ☼ Reliability
Description
This PR introduces new deprecation behavior for Options.new(profile:) and Chromium::Profile.new,
but removes Chrome/Edge profile test targets from the Ruby spec suite, reducing coverage for
still-supported code paths. This increases regression risk and conflicts with the expectation to
update/keep tests in step with behavior changes.
Code

rb/spec/BUILD.bazel[L41-45]

Evidence
Rule 6 and Rule 15 require keeping tests updated when production behavior changes. The PR adds new
deprecation warnings in the production code, while the Ruby spec aggregation no longer includes
Chrome/Edge profile tests, leaving these changed code paths without corresponding coverage.

AGENTS.md: Prefer Adding/Updating Tests for Changes; Prefer Small (Unit) Tests Over Browser Tests
rb/lib/selenium/webdriver/chromium/options.rb[70-82]
rb/lib/selenium/webdriver/chromium/profile.rb[30-41]
rb/spec/BUILD.bazel[36-96]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
New deprecation behavior was added for Chromium profile usage, but the Chrome/Edge `Profile` tests were removed from the test suite, leaving these still-present APIs without coverage.

## Issue Context
- `Options#initialize` now emits a deprecation when `profile:` is provided.
- `Chromium::Profile#initialize` now emits a deprecation.
- `rb/spec/BUILD.bazel` no longer includes Chrome/Edge profile unit/integration test targets.

## Fix Focus Areas
- rb/lib/selenium/webdriver/chromium/options.rb[70-82]
- rb/lib/selenium/webdriver/chromium/profile.rb[27-36]
- rb/spec/BUILD.bazel[36-96]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Duplicate deprecation warnings 🐞 Bug ⚙ Maintainability
Description
Using the typical pattern profile = Chrome::Profile.new; Chrome::Options.new(profile: profile) now
emits two separate deprecation warnings (one from Profile#initialize and one from
Options#initialize), which can spam stderr/log consumers and obscure other warnings.
Code

rb/lib/selenium/webdriver/chromium/options.rb[R73-79]

Evidence
Options emits a deprecation whenever the profile: kwarg is provided, and Profile emits a
deprecation on every instantiation; together they produce duplicate warnings for the standard usage.
The logger implementation also emits an additional informational log on the first warning,
compounding output volume.

rb/lib/selenium/webdriver/chromium/options.rb[70-96]
rb/lib/selenium/webdriver/chromium/profile.rb[30-41]
rb/lib/selenium/webdriver/common/logger.rb[192-240]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Creating a Chromium Profile and then passing it through `Options.new(profile:)` triggers **two** deprecation warnings for a single deprecated usage pattern. This increases log noise and can disrupt users who treat warnings/stderr output as actionable signals.

### Issue Context
- `Chromium::Options#initialize` emits a deprecation when `profile:` is provided.
- `Chromium::Profile#initialize` emits a deprecation on every instantiation.
- Selenium logger also prints additional logger-help text on the first warning, amplifying the noise.

### Fix Focus Areas
- rb/lib/selenium/webdriver/chromium/options.rb[70-96]
- rb/lib/selenium/webdriver/chromium/profile.rb[30-41]

### Suggested change
Implement a dedupe strategy so the common flow only warns once, e.g.:
- Only warn in `Options#initialize(profile:)` when `profile` is **not** a `Chromium::Profile` instance (since that constructor already warns), OR
- Only warn in one place (either Profile constructor or Options kwarg) and remove the other, OR
- Add an internal "warned" flag keyed by the deprecation id to ensure each deprecation is logged once per process.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

3. Deprecated kwarg still documented 🐞 Bug ⚙ Maintainability
Description
Chromium::Options still documents the profile kwarg as a normal supported parameter, but the
implementation now deprecates it, which will keep encouraging new usage of the deprecated API.
Code

rb/lib/selenium/webdriver/chromium/options.rb[R73-79]

Evidence
The initializer now deprecates use of profile:, but the method documentation still advertises
profile as a standard parameter, creating a mismatch between docs and behavior.

rb/lib/selenium/webdriver/chromium/options.rb[46-58]
rb/lib/selenium/webdriver/chromium/options.rb[70-96]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The YARD documentation for `Chromium::Options#initialize` still describes `profile` as a regular parameter, even though the initializer now emits a deprecation warning when it is used.

### Issue Context
Developers relying on generated docs/IDE hints will continue adopting `profile:` despite the deprecation.

### Fix Focus Areas
- rb/lib/selenium/webdriver/chromium/options.rb[46-60]
- rb/lib/selenium/webdriver/chromium/options.rb[70-96]

### Suggested change
Update the docstring to explicitly mark `profile` as deprecated (e.g., add `@deprecated` note near the param, or amend the `@param profile` line to say it is deprecated and point to `add_argument('--user-data-dir=...')`, `add_preference`, and `add_extension`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@aguspe
aguspe merged commit b8b2c08 into trunk May 23, 2026
42 checks passed
@aguspe
aguspe deleted the profiles_rb branch May 23, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations C-rb Ruby Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants