Skip to content
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

Feature request: Add VersionResolveStrategy.MachingBrowser for firefox #189

Open
DSPaul opened this issue Jun 2, 2022 · 2 comments
Open

Comments

@DSPaul
Copy link
Contributor

DSPaul commented Jun 2, 2022

RP #186 implemented GetMatchingBrowserVersion for Firefox which is a great first step but unfortunately the version of firefox is not the same as the version of the mozilla geckodriver so it is not suitable to use directly with VersionResolveStrategy.MachingBrowser.

For the current version of firefox for example which at the time of writing is v100.0.2, it should download driver v0.31.0. So when you try to use MatchingBrowser, it tries to download from https://github.com/mozilla/geckodriver/releases/download/v100.0.2/geckodriver-v100.0.2-win64.zip which does not exist, resulting in an error.

The relation between firefox version and compatible drivers can be found here: https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html. Might take a crack at this myself if I find time, but it's more likely that I won't than that I will.

@gburghardt
Copy link

I noticed this as well. I'm starting to think that the VersionResolveStrategy is not uniform across browser vendors. I can see two possible solutions:

  1. (no public API changes) Treat "MatchingBrowser" the same as "Latest" for Firefox. Not sure how to document this, though.

  2. (breaking public API changes) Remove the VersionResolveStrategy class. Push the logic of which version to use into the respective browser config classes. For Firefox, that simply means only an exact version or latest version can be used.

    Some ideas:

    // assumes "latest" version supported by current firefox installation
    new FirefoxConfig();
    
    // assumes "latest" version supported by current firefox installation
    new FirefoxConfig(FirefoxVersion.Latest);
    
    // assumes "latest" version supported by current firefox installation
    new FirefoxConfig().LatestVersion();
    
    // specify he exact version you want
    new FirefoxConfig(FirefoxVersion.Exact("0.31.0"));
    
    // specify the exact version you want
    new FirefoxConfig().Version("0.31.0");
    
    new FirefoxConfig().MatchingBrowser();
    //                  ~~~~~~~~~~~~~~~
    // Visual Studio shows "red squiggly lines" because this is not
    // a valid version strategy for Firefox. Solution will not build.

I'm liking the fluent API approach.

Thoughts?

@yafjama22
Copy link

yafjama22 commented Sep 29, 2022

I see in the Java implementation of WDM, they have a file in which they keep a key/value pair in a property file and match it like that. Maybe something like this could be a solution but it would need to be maintained.

Link to property file (line 52 is Firefox)
https://github.com/bonigarcia/webdrivermanager/blob/master/src/main/resources/versions.properties

Link to WDM Java version (3.1 and 3.1.1)
https://bonigarcia.dev/webdrivermanager/#driver-management

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants