Skip to content

Conversation

bonigarcia
Copy link
Member

Description

This PR implements the Rust logic required to manage Chrome for Testing (CfT) binaries: unstable channels (beta/dev/canary) and fixed versions (e.g., 113, 114, 115, etc.).

Here it is some examples of its usage:

Chrome stable (forced download)

C:\Users\boni\Documents\dev\selenium\rust>cargo run -- --browser chrome --debug --force-browser-download
DEBUG   Checking chromedriver in PATH
DEBUG   Running command: chromedriver --version
DEBUG   Output: ""
DEBUG   chromedriver not found in PATH
DEBUG   Reading metadata from https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json
DEBUG   Required browser: chrome 115.0.5790.102
DEBUG   Downloading chrome 115.0.5790.102 from https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.102/win64/chrome-win64.zip
DEBUG   chrome 115.0.5790.102 has been downloaded at C:\Users\boni\.cache\selenium\chrome\win64\115.0.5790.102\chrome.exe
DEBUG   Reading metadata from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
DEBUG   Required driver: chromedriver 115.0.5790.102
DEBUG   Driver URL: https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.102/win64/chromedriver-win64.zip
INFO    Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\115.0.5790.102\chromedriver.exe
INFO    Browser path: C:\Users\boni\.cache\selenium\chrome\win64\115.0.5790.102\chrome.exe

Chrome beta (already installed)

C:\Users\boni\Documents\dev\selenium\rust>cargo run -- --browser chrome --debug --browser-version beta
DEBUG   Checking chromedriver in PATH
DEBUG   Running command: chromedriver --version
DEBUG   Output: ""
DEBUG   chromedriver not found in PATH
DEBUG   chrome detected at C:\Program Files\Google\Chrome Beta\Application\chrome.exe
DEBUG   Using shell command to find out chrome version
DEBUG   Running command: wmic datafile where name='C:\\Program Files\\Google\\Chrome Beta\\Application\\chrome.exe' get Version /value
DEBUG   Output: "\r\r\n\r\r\nVersion=116.0.5845.42\r\r\n\r\r\n\r\r\n\r"
DEBUG   Detected browser: chrome 116.0.5845.42
DEBUG   Reading metadata from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
DEBUG   Required driver: chromedriver 116.0.5845.42
DEBUG   Driver URL: https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.42/win64/chromedriver-win64.zip
INFO    Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\116.0.5845.42\chromedriver.exe
INFO    Browser path: C:\Program Files\Google\Chrome Beta\Application\chrome.exe

Chrome dev (not available, and so, CfT is downloaded)

C:\Users\boni\Documents\dev\selenium\rust>cargo run -- --browser chrome --debug --browser-version dev
DEBUG   Checking chromedriver in PATH
DEBUG   Running command: chromedriver --version
DEBUG   Output: ""
DEBUG   chromedriver not found in PATH
DEBUG   Checking chrome in PATH
DEBUG   Running command: where chrome
DEBUG   Output: ""
DEBUG   chrome not found in PATH
DEBUG   chrome has not been discovered in the system
DEBUG   Reading metadata from https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json
DEBUG   Required browser: chrome 117.0.5897.3
DEBUG   Downloading chrome 117.0.5897.3 from https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5897.3/win64/chrome-win64.zip
DEBUG   chrome 117.0.5897.3 has been downloaded at C:\Users\boni\.cache\selenium\chrome\win64\117.0.5897.3\chrome.exe
DEBUG   Reading metadata from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
DEBUG   Required driver: chromedriver 117.0.5908.0
DEBUG   Driver URL: https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5908.0/win64/chromedriver-win64.zip
INFO    Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\117.0.5908.0\chromedriver.exe
INFO    Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5897.3\chrome.exe

Chrome 113 (not available, and so, CfT is downloaded)

C:\Users\boni\Documents\dev\selenium\rust>cargo run -- --browser chrome --debug --browser-version 113
DEBUG   Checking chromedriver in PATH
DEBUG   Running command: chromedriver --version
DEBUG   Output: ""
DEBUG   chromedriver not found in PATH
DEBUG   chrome detected at C:\Program Files\Google\Chrome\Application\chrome.exe
DEBUG   Using shell command to find out chrome version
DEBUG   Running command: wmic datafile where name='C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' get Version /value
DEBUG   Output: "\r\r\n\r\r\nVersion=115.0.5790.99\r\r\n\r\r\n\r\r\n\r"
DEBUG   Detected browser: chrome 115.0.5790.99
DEBUG   Discovered browser version (115) different to specified browser version (113)
DEBUG   Reading metadata from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
DEBUG   Required browser: chrome 113.0.5672.63
DEBUG   Downloading chrome 113.0.5672.63 from https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/113.0.5672.63/win64/chrome-win64.zip
DEBUG   chrome 113.0.5672.63 has been downloaded at C:\Users\boni\.cache\selenium\chrome\win64\113.0.5672.63\chrome.exe
DEBUG   Reading chromedriver version from https://chromedriver.storage.googleapis.com/LATEST_RELEASE_113
DEBUG   Required driver: chromedriver 113.0.5672.63
DEBUG   Driver URL: https://chromedriver.storage.googleapis.com/113.0.5672.63/chromedriver_win32.zip
INFO    Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\113.0.5672.63\chromedriver.exe
INFO    Browser path: C:\Users\boni\.cache\selenium\chrome\win64\113.0.5672.63\chrome.exe

Motivation and Context

This PR is a continuation of #12353 and implements #11678. It allows to download CfT browser binaries, starting on Chrome 113 (the first version released as CfT).

Now, we need to decide if we want to support the management of even older Chromium releases (e.g., 112, 111, etc.). This could be done by mapping these releases (using the info published in the Chromium Dash).

@diemol @titusfortner Do we want to manage these Chromium versions (i.e., older than 113)? It is feasible. In fact, this was the original idea before releasing CfT.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@bonigarcia bonigarcia added the C-rust Rust code is mostly Selenium Manager label Jul 24, 2023
@bonigarcia bonigarcia force-pushed the se_mgr_chrome_versions branch from 6e93473 to 1c69ad9 Compare July 24, 2023 23:34
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 36.19% and project coverage change: -0.86% ⚠️

Comparison is base (592d8e8) 58.09% compared to head (a49df23) 57.24%.

❗ Current head a49df23 differs from pull request most recent head 1c69ad9. Consider uploading reports for the commit 1c69ad9 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #12410      +/-   ##
==========================================
- Coverage   58.09%   57.24%   -0.86%     
==========================================
  Files          86       86              
  Lines        5348     5356       +8     
  Branches      207      206       -1     
==========================================
- Hits         3107     3066      -41     
- Misses       2034     2084      +50     
+ Partials      207      206       -1     
Files Changed Coverage Δ
py/selenium/webdriver/common/bidi/cdp.py 22.64% <0.00%> (ø)
py/selenium/webdriver/common/proxy.py 15.09% <0.00%> (ø)
py/selenium/webdriver/common/options.py 33.66% <17.18%> (-41.34%) ⬇️
py/selenium/webdriver/common/selenium_manager.py 56.52% <50.00%> (-6.39%) ⬇️
py/selenium/webdriver/firefox/webdriver.py 64.47% <50.00%> (ø)
py/selenium/__init__.py 100.00% <100.00%> (ø)
py/selenium/webdriver/__init__.py 100.00% <100.00%> (ø)
...y/selenium/webdriver/chromium/remote_connection.py 28.00% <100.00%> (-2.77%) ⬇️
py/selenium/webdriver/common/utils.py 100.00% <100.00%> (ø)
py/selenium/webdriver/remote/switch_to.py 56.25% <100.00%> (ø)
... and 2 more

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

@titusfortner
Copy link
Member

Do we want to manage these Chromium versions
I'd put it at a much lower priority now... Is it going to be the same as Edge? Are they both only going to be Chromium versions?

I think we should get Firefox working next.

@bonigarcia bonigarcia force-pushed the se_mgr_chrome_versions branch from 1c69ad9 to d86b1d4 Compare July 25, 2023 13:34
@bonigarcia bonigarcia merged commit d86b1d4 into trunk Jul 25, 2023
@bonigarcia bonigarcia deleted the se_mgr_chrome_versions branch July 25, 2023 13:54
@bonigarcia bonigarcia restored the se_mgr_chrome_versions branch July 25, 2023 14:07
@bonigarcia bonigarcia deleted the se_mgr_chrome_versions branch July 25, 2023 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-rust Rust code is mostly Selenium Manager
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants