Open DSPaul opened 2 years ago
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:
(no public API changes) Treat "MatchingBrowser" the same as "Latest" for Firefox. Not sure how to document this, though.
(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?
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
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.