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

Change version to MatchingBrowser and improve Edge support. #99

Merged
merged 3 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions WebDriverManager.Tests/EdgeConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,5 @@ public void DriverDownloadTest()
new DriverManager().SetUpDriver(new EdgeConfig());
Assert.NotEmpty(WebDriverFinder.FindFile(GetBinaryName()));
}

[Fact]
public void GetMatchingBrowserVersionTest()
{
Assert.Throws<NotImplementedException>(() => GetMatchingBrowserVersion());
}
}
}
2 changes: 1 addition & 1 deletion WebDriverManager.Tests/FirefoxConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void DriverDownloadTest()
[Fact]
public void GetMatchingBrowserVersionTest()
{
Assert.Throws<NotImplementedException>(() => GetMatchingBrowserVersion());
Assert.Throws<NotImplementedException>(GetMatchingBrowserVersion);
}
}
}
2 changes: 1 addition & 1 deletion WebDriverManager.Tests/InternetExplorerConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void DriverDownloadTest()
[Fact]
public void GetMatchingBrowserVersionTest()
{
Assert.Throws<NotImplementedException>(() => GetMatchingBrowserVersion());
Assert.Throws<NotImplementedException>(GetMatchingBrowserVersion);
}
}
}
2 changes: 1 addition & 1 deletion WebDriverManager.Tests/LegacyEdgeConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void DriverDownloadTest()
[Fact]
public void GetMatchingBrowserVersionTest()
{
Assert.Throws<NotImplementedException>(() => GetMatchingBrowserVersion());
Assert.Throws<NotImplementedException>(GetMatchingBrowserVersion);
}
}
}
2 changes: 1 addition & 1 deletion WebDriverManager.Tests/OperaConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void DriverDownloadTest()
[Fact]
public void GetMatchingBrowserVersionTest()
{
Assert.Throws<NotImplementedException>(() => GetMatchingBrowserVersion());
Assert.Throws<NotImplementedException>(GetMatchingBrowserVersion);
}
}
}
2 changes: 1 addition & 1 deletion WebDriverManager.Tests/PhantomConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void DriverDownloadTest()
[Fact]
public void GetMatchingBrowserVersionTest()
{
Assert.Throws<NotImplementedException>(() => GetMatchingBrowserVersion());
Assert.Throws<NotImplementedException>(GetMatchingBrowserVersion);
}
}
}
16 changes: 8 additions & 8 deletions WebDriverManager/DriverConfigs/Impl/ChromeConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ public virtual string GetLatestVersion()
return GetLatestVersion(LatestReleaseVersionUrl);
}

public virtual string GetMatchingBrowserVersion()
{
var rawChromeBrowserVersion = RegistryHelper.GetInstalledBrowserVersion(BrowserExecutableFileName);
var chromeBrowserVersion = VersionHelper.GetVersionWithoutRevision(rawChromeBrowserVersion);
var url = ExactReleaseVersionPatternUrl.Replace("<version>", chromeBrowserVersion);
return GetLatestVersion(url);
}

private static string GetLatestVersion(string url)
{
var uri = new Uri(url);
Expand All @@ -83,5 +75,13 @@ private static string GetLatestVersion(string url)
}
}
}

public virtual string GetMatchingBrowserVersion()
{
var rawChromeBrowserVersion = RegistryHelper.GetInstalledBrowserVersion(BrowserExecutableFileName);
var chromeBrowserVersion = VersionHelper.GetVersionWithoutRevision(rawChromeBrowserVersion);
var url = ExactReleaseVersionPatternUrl.Replace("<version>", chromeBrowserVersion);
return GetLatestVersion(url);
}
}
}
14 changes: 12 additions & 2 deletions WebDriverManager/DriverConfigs/Impl/EdgeConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
using System.IO;
using System.Net;
using System.Runtime.InteropServices;
using WebDriverManager.Helpers;

namespace WebDriverManager.DriverConfigs.Impl
{
public class EdgeConfig : IDriverConfig
{
private const string BaseVersionPatternUrl = "https://msedgedriver.azureedge.net/<version>/";
private const string LatestReleaseVersionUrl = "https://msedgedriver.azureedge.net/LATEST_STABLE";

private const string BrowserExecutableFileName = "msedge.exe";

public virtual string GetName()
{
Expand Down Expand Up @@ -35,7 +39,12 @@ public virtual string GetBinaryName()

public virtual string GetLatestVersion()
{
var uri = new Uri("https://msedgedriver.azureedge.net/LATEST_STABLE");
return GetLatestVersion(LatestReleaseVersionUrl);
}

public virtual string GetLatestVersion(String url)
{
var uri = new Uri(url);
var webRequest = WebRequest.Create(uri);
using (var response = webRequest.GetResponse())
{
Expand All @@ -53,7 +62,8 @@ public virtual string GetLatestVersion()

public string GetMatchingBrowserVersion()
{
throw new NotImplementedException();
var rawEdgeBrowserVersion = RegistryHelper.GetInstalledBrowserVersion(BrowserExecutableFileName);
return rawEdgeBrowserVersion;
}
}
}