Skip to content

chore(deps): bump selenium 4.14.0+ - #25933

Merged
rusackas merged 7 commits into
apache:masterfrom
gnought:fix_selenium
Jan 13, 2025
Merged

rusackas merged 7 commits into
apache:masterfrom
gnought:fix_selenium

Conversation

@gnought

@gnought gnought commented Nov 9, 2023 •

Copy link
Copy Markdown
Contributor

SUMMARY

This is a proper fix for the PR #24538.

However we have to think about how the WEBDRIVER_CONFIGURATION should be. The selenium 4.10+ only allows options and services to be passed to the WebDriver constructor.
https://github.com/SeleniumHQ/selenium/blob/c14d9678990942b93cb421c5567d0da7fb29c7bd/py/selenium/webdriver/firefox/webdriver.py#L41-L46

kwargs.update(current_app.config["WEBDRIVER_CONFIGURATION"])
logger.debug("Init selenium driver")
return driver_class(**kwargs)

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue: Fixes update superset 3.1.0/3.1.1 dependency "selenium 3.141.0" #26992
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@john-bodley
john-bodley self-requested a review November 9, 2023 18:00
@john-bodley john-bodley added the review:checkpoint Last PR reviewed during the daily review standup label Nov 9, 2023
@john-bodley

Copy link
Copy Markdown
Member

Thanks @gnought for the change. As your point out with Selenium 4.10+ the WebDriver signature changed which means that existing WEBDRIVER_CONFIGURATION definitions (including the default) could fail and thus this would be deemed a breaking change. It seems prudent to hold off this change until when the breaking window opens for Superset 4.0.

@john-bodley john-bodley removed the review:checkpoint Last PR reviewed during the daily review standup label Nov 10, 2023
Comment thread superset/config.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnought would you mind providing context for this change? Note irrespective of what the default values are this would still be deemed a breaking change given that the customizable Superset configurations are deemed a public interface.

CC @michael-s-molina for context regarding our recent discussion on breaking changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@john-bodley

In 4.9.0, service_log_path is one of parameters in WebDriver constructor.
https://github.com/SeleniumHQ/selenium/blob/bc7e0c7341fdde78cdd80ce572002a7866fd1769/py/selenium/webdriver/firefox/webdriver.py#L90-L110

However it is no longer in 4.10.0+.
https://github.com/SeleniumHQ/selenium/blob/c14d9678990942b93cb421c5567d0da7fb29c7bd/py/selenium/webdriver/firefox/webdriver.py#L50-L53

The following commit will support 4.10.0. It also opens for users to refine Webdrver Options and Service.
For sure, this will be a breaking change if users defining WEBDRIVER_CONFIGURATION themselves using 4.9.0 WebDriver defintion.

@gnought gnought changed the title chore: support selenium 4.10.0+ chore(deps): bump selenium 4.10.0+ Nov 12, 2023
@michael-s-molina michael-s-molina added risk:breaking-change Issues or PRs that will introduce breaking changes hold! On hold labels Nov 13, 2023
Comment thread superset/utils/webdriver.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnought thanks for refactoring, however I sense this change isn't suffice. The TL;DR is either:

  1. We hold of this change until 4.0 when the breaking window opens, or
  2. We need to mutate existing user defined WEBDRIVER_CONFIGURATION to conform to the new options/service structure.

For example in the current form if an implementation has defined the following,

WEBDRIVER_CONFIGURATION = {"service_log_path": "/dev/null"}

then said configuration would be lost if this PR was merged because the service_log_path key isn't handled. It would be good to look at the Selenium changelog and check the codebase to see whether they have a mechanism for migrating from the old to new WebDriver class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@john-bodley, modified code a bit for backward compatibility. Hope it makes us feel safe.

@nigzak

nigzak commented Feb 21, 2024

Copy link
Copy Markdown
Contributor

FYI: if the change is made it should be updated to 4.14.x (or newer) to fix a CVE finding (refer linked #26992)

@rusackas
rusackas requested a review from kgabryje February 21, 2024 16:37
@rusackas

Copy link
Copy Markdown
Member

Unfortunately, I think this missed the proposal window for breaking changes, and will have to go into 5.0. I'l add it to that project board now. I'm also not sure where we stand with the potential migration to Playwright (thus tagging @kgabryje here) and if that will become the standard by 5.0. If we want to proceed with this upgrade, which seems sensible, this PR will just need a rebase and bump to 4.14.x or greater by the time that breaking window re-opens.

@rusackas

Copy link
Copy Markdown
Member

This has also been updated to auto-close #26992 when it does become mergeable.

@nigzak

nigzak commented Feb 21, 2024

Copy link
Copy Markdown
Contributor

Hi @rusackas
the pull request here seems to update it to V4.10.x - only have in mind it should be updated to >= V4.14.x (newer as it is in this pull request)

@mistercrunch

mistercrunch commented Apr 3, 2024 •

Copy link
Copy Markdown
Member

FYI I fixed the merge conflicts, can we remove the hold on this one?

In any case if the interface changed we should add a line in UPDATING.md as part of this PR

@michael-s-molina

Copy link
Copy Markdown
Member

FYI I fixed the merge conflicts, can we remove the hold on this one?

@mistercrunch We can't remove the hold label if the PR contains a breaking change. That will only be possible during a breaking window.

@villebro

Copy link
Copy Markdown
Member

@gnought we want to push this through for Superset 5.0 (we're approaching the breaking window during which this can be merged). Would you be able to rebase this PR and fix failing CI checks?

@gnought gnought changed the title chore(deps): bump selenium 4.10.0+ chore(deps): bump selenium 4.14.0+ Dec 12, 2024
@codecov

codecov Bot commented Dec 12, 2024 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.01%. Comparing base (76d897e) to head (6712ad3).
⚠️ Report is 2203 commits behind head on master.

Files with missing lines Patch % Lines
superset/utils/webdriver.py 81.81% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #25933       +/-   ##
===========================================
+ Coverage   60.48%   83.01%   +22.52%     
===========================================
  Files        1931      538     -1393     
  Lines       76236    39038    -37198     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    32406    -13708     
+ Misses      28017     6632    -21385     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 48.40% <21.73%> (-0.76%) ⬇️
javascript ?
mysql 74.49% <82.60%> (?)
postgres 74.51% <82.60%> (?)
presto 51.99% <21.73%> (-1.82%) ⬇️
python 83.03% <82.60%> (+19.53%) ⬆️
sqlite 73.93% <82.60%> (?)
unit 60.89% <21.73%> (+3.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gnought

gnought commented Dec 12, 2024

Copy link
Copy Markdown
Contributor Author

@gnought we want to push this through for Superset 5.0 (we're approaching the breaking window during which this can be merged). Would you be able to rebase this PR and fix failing CI checks?

@villebro done.

@rusackas rusackas added risk:breaking-change Issues or PRs that will introduce breaking changes and removed risk:breaking-change Issues or PRs that will introduce breaking changes hold! On hold labels Jan 7, 2025
@rusackas

rusackas commented Jan 7, 2025

Copy link
Copy Markdown
Member

We are now good to merge this, but it looks like there's a conflict that needs resolution. I would hand-edit the base.txt file to resolve it, but now we use uv and pyproject.toml for this, so it's a bit different than it was when this was opened.

@rusackas

rusackas commented Jan 8, 2025

Copy link
Copy Markdown
Member

@gnought It looks like after a rebase, you'll just need to do ./scripts/uv-pip-compile.sh -P selenium. You may have to install a bunch of stuff first, e.g.

$ python3 -m venv venv
$ source venv/bin/activate
$ python3 -m pip install -r requirements/development.txt
$ ./scripts/uv-pip-compile.sh

I also had to pip install uv personally... not sure why that didn't come along for the ride.

CC @mistercrunch who can fact-check me on any of the above.

Alternatively, if you can give me write access on this fork/branch, I can try to push a commit.

@gnought

gnought commented Jan 10, 2025

Copy link
Copy Markdown
Contributor Author

@rusackas I sent you an invite to my fork.

@mistercrunch

mistercrunch commented Jan 10, 2025 •

Copy link
Copy Markdown
Member

./scripts/uv-pip-compile.sh -P {package-you-want-to-update} is the new way to go. Highly recommend using uv locally too in place of pyenv/pip/virtualenv/pip-tools/pip-compile-multi/...

It replaces all that stuff with a comprehensive, blazing-fast, smart-caching-all-around solution

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jan 13, 2025
@rusackas

Copy link
Copy Markdown
Member

bumped it to 4.27.1... let's see if it works! 🤞

@rusackas
rusackas merged commit 44ff462 into apache:master Jan 13, 2025
@rusackas
rusackas deleted the fix_selenium branch January 13, 2025 21:52
@fisjac

fisjac commented Jan 17, 2025 •

Copy link
Copy Markdown
Contributor

I'm running into issues with generating screenshots with the webdriver following the version bump. Trying to fix locally

edit this was a result of not having the proper dev packages installed within the superset_worker container. Installing Geckodriver firefox and the relevant deps to run firefox -headless solved the issue.

@michael-s-molina

Copy link
Copy Markdown
Member

@rusackas @gnought Am I correct in assuming that you can't change the firefox_binary using the configurations after this change? Or am I missing something?

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 5.0.0 First shipped in 5.0.0 labels Jul 29, 2025
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels risk:breaking-change Issues or PRs that will introduce breaking changes size/L 🚢 5.0.0 First shipped in 5.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update superset 3.1.0/3.1.1 dependency "selenium 3.141.0"

8 participants