-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[rust] Download latest version of Chrome for Testing (#11676) #12353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportPatch and project coverage have no change.
❗ 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 #12353 +/- ##
=======================================
Coverage 58.09% 58.09%
=======================================
Files 86 86
Lines 5348 5348
Branches 207 207
=======================================
Hits 3107 3107
Misses 2034 2034
Partials 207 207 ☔ View full report in Codecov by Sentry. |
0a16431
to
fd77a27
Compare
I'm not sure I understand the
And it doesn't look like we always get the browser location back. I think we should always report the browser location for what we are using to match the driver. When running command line without What is the difference now between using |
Do we really need this on this first iteration? In short, we want to download the browser if the user does not have it. And starting to cache versions from CfT would mean that we want to update the browser as well? |
From the bindings perspective, you can safely ignore this flag. I added it for two reasons. First, I need a way to test this feature in CI (CfT is only downloaded when Chrome is unavailable, and in GH Actions, Chrome is already installed). Second, it can potentially be used by someone to download CfT even when a complete Chrome release is already in the system.
That is what this feature does. When Chrome is not found, the latest version of CfT is downloaded.
That is not part of this PR. It will be implemented for #11678.
Currently, the browser path is only returned when CfT is downloaded. But indeed, Selenium Manager can always return the browser path (the found one or the downloaded one). Do you want to implement it that way?
See "Resolving chrome (forced) for the first time (regular output)" on the Gist document.
Selenium Manager works in the same way for both flags. It is a way to select a "manager" (i.e., a module for managing driver/browser for different vendors, such as Chrome, Firefox, or Edge) by browser name (chrome, firefox, edge) or driver name (chromedriver, geckodriver, msedgedriver). But once the manager is defined, the behavior is the same. |
The TTL mechanism is a way to improve the overall performance of the browser/driver management. So strictly, we don't need it for this iteration. But since this is already implemented for drivers, I decided to use it for browser version discovery like it is already used for driver version discovery (which, in both cases, it requires network requests to remote endpoints). And as usual, we can put it to |
That is the question, do we need to do browser version discovery always or only when we do not find the Chrome browser in the system? |
Browser version discovery using shell commands is always done. And now, when the browser is not discovered in the system, remote (for download) browser version discovery (using CfT endpoints) is used. And that found version is written in the metadata (considered fresh using the |
Yes, please. Right now the bindings can't even make use of the feature you implemented to reference beta/dev versions because we have no way to tell the driver to use them. Currently we can get the browser binary path from the options class, and we next need to implement setting it. If we always have the browser value returned we can always just set it. |
I managed to run this PR in a macOS VM and found a relevant difference. In macOS, the CtF binary package is called Also, I have updated the Gist document, including the Selenium Manager output in macOS (see the two last snippets). |
No problem, I will do that. I inspected what needs to be done in the code, and it requires different changes. So I prefer to do it in a separate PR since this one is already quite big. |
909685f
to
ee422c4
Compare
I have implemented the requested feature, i.e., always returning the browser path (the found one or the downloaded one). For that, I have a local commit on top of the commits of this PR. Should I commit these new changes as part of this PR, or should I wait until this PR is accepted and merged? |
c856961
to
79499e1
Compare
this PR is important -
|
@nir-tal-talkspace In fact, the important PR for discovering chromedriver 115+ is #12208. It is already merged, but unfortunately, it is unavailable in Selenium 4.10.0. |
58f4f8f
to
395d144
Compare
I believe we don't want to merge this PR until Selenium 4.11.0 is released, so I have just sent two new commits to this PR. With these new commits:
Here it is some examples of the output:
For the bindings, the JSON output is what matters. Notice that now, there are two new fields: @diemol @titusfortner What do you think? |
729a203
to
beb12d6
Compare
@bonigarcia can you rebase this one? If Google isn't going to fix their bug right away, maybe we should knock out the fix in Selenium after all since none of the 3rd party managers can do what we can do. 😆 |
Shouldn't this get v116? Or are we only working on stable right now?
|
b8fbd69
to
48835df
Compare
a52bd11
to
8879140
Compare
8879140
to
68e7901
Compare
Now it's fixed.
With the latest changes, yes.
I included a couple of new commits in this PR to make more robust the path manipulation (escaped or not).
Great, let me know if everything works as expected with the latest changes. |
Yes, everything works exactly as expected on MacOS and Windows! |
Oh, one thing... I think if "beta" "dev" "canary" "nightly" etc aren't found on the system it should error and not download the latest stable version of the browser. |
Description
This PR implements the first feature for automated browser management in Selenium Manager, concretely for the latest version of Chrome for Testing (CfT).
The general procedure of this feature is as follows. When the user (e.g., the bindings) invokes Selenium Manager, currently, only the driver is managed (i.e., downloaded and cached). With this PR, when managing Chrome, the browser binary will also be managed (if it is not present in the system). Moreover, this PR includes the flag
--force-browser-download
to force downloading of the browser (even in the -usual- case that Chrome is already installed). I created a Gist document to showcase the most representative cases.Different things have changed with PR and deserve attention and discussion. Comments are welcome. Maybe the most relevant change is the output of Selenium Manager. So far, when using the JSON output, the field
result.message
contained the driver path. With this PR, this is no longer convenient since Selenium Manager can return two things: the driver path and (optionally) the browser path. Therefore, with this PR, there are two new JSON fields:result.driver_path
andresult.browser_path
. These values should be read in the bindings. See the previous Gist snippets for examples.A second change has to do with the browser TTL. So far, the browser TTL was used to cache the browser versions discovered by running shell command(s). But by default, the
browser_TTL
was0
, so in practice, this caching mechanism (stored in the local metadata file, i.e.,~/.cache/selenium/selenium-manager.json
) is not used (although the logic is present in the Rust code).With this PR, network calls to the CfT endpoints are used to discover the latest version of Chrome (very similar to what happens with chromedriver and other drivers). I believe these discovered versions deserve better to be cached in the local metadata. Therefore, I made two changes related to this:
browser_TTL
, from0
to3600
seconds (i.e., 1 hour, in the same way thandriver_TTL
. As a possible idea for the future, we can unify both TTLs in a single.Finally, the overall timeout for network requests has been increased from
180
(in seconds) to300
since browser download takes longer than driver download.Motivation and Context
This is the first PR related to milestone 4 in the original Selenium Manager roadmap, i.e., "M4: Browser management: Chrome/Chromium".
I have tested this feature both in Windows and Linux. Moreover, the tests are executed in Windows, Linux, and macOS on GitHub actions. Unfortunately, I no longer have a macOS, so I did have the chance to test it locally on a macOS machine. It would be great if someone could try this PR on macOS.
Types of changes
Checklist