Skip to content

Commit 9b1ffd9

Browse files
committed
Update edge driver home page. Fix marionette driver download link.
1 parent 7327268 commit 9b1ffd9

File tree

8 files changed

+71
-27
lines changed

8 files changed

+71
-27
lines changed

WebDriverManager/BrowserManagers/EdgeDriverManager.cs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class EdgeDriverManager : Logging, IBaseBrowserManager
1212
WebDriverManagerConfig config = new WebDriverManagerConfig
1313
{
1414
binary = "MicrosoftWebDriver.exe",
15-
url = "https://download.microsoft.com/download/1/4/1/14156DA0-D40F-460A-B14D-1B264CA081A5/MicrosoftWebDriver.exe",
15+
url = string.Empty,
1616
pathVariable = "webdriver.edge.driver",
1717
architecture = Architecture.x32.ToString()
1818
};
@@ -25,10 +25,10 @@ public string GetLatestVersion()
2525
{
2626
string version = null;
2727
var doc = new HtmlDocument();
28-
var htmlCode = client.DownloadString("https://www.microsoft.com/en-us/download/details.aspx?id=48740");
28+
var htmlCode = client.DownloadString("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver");
2929
doc.LoadHtml(htmlCode);
30-
var itemList = doc.DocumentNode.SelectNodes("//*[@class='fileinfo']//p").Select(p => p.InnerText).ToList();
31-
version = itemList.FirstOrDefault();
30+
var itemList = doc.DocumentNode.SelectNodes("//ul[contains(@class, 'subsection__body')]//p[2]").Select(p => p.InnerText).ToList();
31+
version = itemList.FirstOrDefault().Split(' ')[1].Split(' ')[0];
3232
if (version != null || version != string.Empty)
3333
Log?.Info($"Latest edge driver version is '{version}'");
3434
else
@@ -43,10 +43,37 @@ public string GetLatestVersion()
4343
}
4444
}
4545

46+
public string GetDownloadUrl()
47+
{
48+
try
49+
{
50+
using (WebClient client = new WebClient())
51+
{
52+
string url = null;
53+
var doc = new HtmlDocument();
54+
var htmlCode = client.DownloadString("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver");
55+
doc.LoadHtml(htmlCode);
56+
var itemList = doc.DocumentNode.SelectNodes("//ul[contains(@class, 'subsection__body')]//p[1]/a").Select(p => p.GetAttributeValue("href", null)).ToList();
57+
url = itemList.FirstOrDefault();
58+
if (url != null || url != string.Empty)
59+
Log?.Info($"Edge driver download url is '{url}'");
60+
else
61+
Log?.Warn($"Problem with getting edge driver download url. Parsed url is '{url}'");
62+
return url;
63+
}
64+
}
65+
catch (Exception ex)
66+
{
67+
Log?.Error("Error occurred during getting last edge driver download url");
68+
throw new WebDriverManagerException("Error occurred during getting last edge driver download url", ex);
69+
}
70+
}
71+
4672
public EdgeDriverManager()
4773
: base()
4874
{
4975
config.version = GetLatestVersion();
76+
config.url = GetDownloadUrl();
5077
}
5178

5279
public void Init()

WebDriverManager/BrowserManagers/MarionetteDriverManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
public class MarionetteDriverManager : Logging, IBaseBrowserManager
1111
{
1212
/// <summary>
13-
/// Set target marionette driver architecture to x32 by default because of only 32 architecture presented
13+
/// Set target marionette driver architecture to x64 by default because of only 64 architecture presented
1414
/// Set binary name as pattern because of it's changing in accordance with marionette driver version
1515
/// </summary>
1616
WebDriverManagerConfig config = new WebDriverManagerConfig
1717
{
1818
binary = "geckodriver.exe",
19-
url = "https://github.com/mozilla/geckodriver/releases/download/v<version>/geckodriver-v<version>-win32.zip",
19+
url = "https://github.com/mozilla/geckodriver/releases/download/v<version>/geckodriver-v<version>-win64.zip",
2020
pathVariable = "webdriver.gecko.driver",
21-
architecture = Architecture.x32.ToString()
21+
architecture = Architecture.x64.ToString()
2222
};
2323

2424
public string GetLatestVersion()

WebDriverManager/Helpers/WebDriverManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ public static void UpdatePath(string variable)
190190
try
191191
{
192192
var name = "PATH";
193-
string pathvar = Environment.GetEnvironmentVariable(name);
194-
var path = pathvar + $@"%{variable}%";
193+
var pathVariable = Environment.GetEnvironmentVariable(name);
194+
var newPathVariable = pathVariable + (pathVariable.EndsWith(";") ? string.Empty : ";") + $@"%{variable}%";
195195

196-
//if (!pathvar.Contains(desticationFolder))
197-
//Environment.SetEnvironmentVariable(name, path, EnvironmentVariableTarget.Machine);
196+
//if (!pathvar.Contains(desticationFolder) && !pathvar.Contains(variable))
197+
//Environment.SetEnvironmentVariable(newPathVariable, name, EnvironmentVariableTarget.Machine);
198198
}
199199
catch (Exception ex)
200200
{

WebDriverManager/NLog.xsd

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@
232232
</xs:extension>
233233
</xs:complexContent>
234234
</xs:complexType>
235-
<xs:complexType name="Layout"></xs:complexType>
236235
<xs:complexType name="Filter" abstract="true"></xs:complexType>
237236
<xs:complexType name="TimeSource" abstract="true"></xs:complexType>
238237
<xs:simpleType name="SimpleLayoutAttribute">
@@ -1020,8 +1019,8 @@
10201019
<xs:element name="archiveFileName" minOccurs="0" maxOccurs="1" type="Layout" />
10211020
<xs:element name="archiveEvery" minOccurs="0" maxOccurs="1" type="NLog.Targets.FileArchivePeriod" />
10221021
<xs:element name="archiveAboveSize" minOccurs="0" maxOccurs="1" type="xs:long" />
1023-
<xs:element name="maxArchiveFiles" minOccurs="0" maxOccurs="1" type="xs:integer" />
10241022
<xs:element name="enableArchiveFileCompression" minOccurs="0" maxOccurs="1" type="xs:boolean" />
1023+
<xs:element name="maxArchiveFiles" minOccurs="0" maxOccurs="1" type="xs:integer" />
10251024
<xs:element name="forceManaged" minOccurs="0" maxOccurs="1" type="xs:boolean" />
10261025
<xs:element name="cleanupFileName" minOccurs="0" maxOccurs="1" type="xs:boolean" />
10271026
<xs:element name="fileName" minOccurs="0" maxOccurs="1" type="Layout" />
@@ -1093,14 +1092,14 @@
10931092
<xs:documentation>Size in bytes above which log files will be automatically archived. Warning: combining this with isn't supported. We cannot create multiple archive files, if they should have the same name. Choose: </xs:documentation>
10941093
</xs:annotation>
10951094
</xs:attribute>
1096-
<xs:attribute name="maxArchiveFiles" type="xs:integer">
1095+
<xs:attribute name="enableArchiveFileCompression" type="xs:boolean">
10971096
<xs:annotation>
1098-
<xs:documentation>Maximum number of archive files that should be kept.</xs:documentation>
1097+
<xs:documentation>Indicates whether to compress archive files into the zip archive format.</xs:documentation>
10991098
</xs:annotation>
11001099
</xs:attribute>
1101-
<xs:attribute name="enableArchiveFileCompression" type="xs:boolean">
1100+
<xs:attribute name="maxArchiveFiles" type="xs:integer">
11021101
<xs:annotation>
1103-
<xs:documentation>Indicates whether to compress archive files into the zip archive format.</xs:documentation>
1102+
<xs:documentation>Maximum number of archive files that should be kept.</xs:documentation>
11041103
</xs:annotation>
11051104
</xs:attribute>
11061105
<xs:attribute name="forceManaged" type="xs:boolean">
@@ -2238,6 +2237,18 @@
22382237
<xs:enumeration value="HttpGet" />
22392238
</xs:restriction>
22402239
</xs:simpleType>
2240+
<xs:complexType name="CompoundLayout">
2241+
<xs:complexContent>
2242+
<xs:extension base="Layout">
2243+
<xs:choice minOccurs="0" maxOccurs="unbounded">
2244+
<xs:element name="layout" minOccurs="0" maxOccurs="unbounded" type="Layout" />
2245+
</xs:choice>
2246+
</xs:extension>
2247+
</xs:complexContent>
2248+
</xs:complexType>
2249+
<xs:complexType name="Layout">
2250+
<xs:choice minOccurs="0" maxOccurs="unbounded" />
2251+
</xs:complexType>
22412252
<xs:complexType name="CsvLayout">
22422253
<xs:complexContent>
22432254
<xs:extension base="Layout">
@@ -2334,8 +2345,14 @@
23342345
<xs:extension base="Layout">
23352346
<xs:choice minOccurs="0" maxOccurs="unbounded">
23362347
<xs:element name="attribute" minOccurs="0" maxOccurs="unbounded" type="NLog.Layouts.JsonAttribute" />
2348+
<xs:element name="renderEmptyObject" minOccurs="0" maxOccurs="1" type="xs:boolean" />
23372349
<xs:element name="suppressSpaces" minOccurs="0" maxOccurs="1" type="xs:boolean" />
23382350
</xs:choice>
2351+
<xs:attribute name="renderEmptyObject" type="xs:boolean">
2352+
<xs:annotation>
2353+
<xs:documentation>Option to render the empty object value {}</xs:documentation>
2354+
</xs:annotation>
2355+
</xs:attribute>
23392356
<xs:attribute name="suppressSpaces" type="xs:boolean">
23402357
<xs:annotation>
23412358
<xs:documentation>Option to suppress the extra spaces in the output json</xs:documentation>

WebDriverManager/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
// You can specify all the values or you can default the Build and Revision Numbers
3535
// by using the '*' as shown below:
3636
//[assembly: AssemblyVersion("1.0.*")]
37-
[assembly: AssemblyVersion("1.1.3")]
38-
[assembly: AssemblyFileVersion("1.1.3")]
37+
[assembly: AssemblyVersion("1.2.0")]
38+
[assembly: AssemblyFileVersion("1.2.0")]

WebDriverManager/WebDriverManager.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
<StartupObject />
3434
</PropertyGroup>
3535
<ItemGroup>
36-
<Reference Include="HtmlAgilityPack, Version=1.4.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
37-
<HintPath>..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
36+
<Reference Include="HtmlAgilityPack, Version=1.4.9.5, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
37+
<HintPath>..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll</HintPath>
3838
<Private>True</Private>
3939
</Reference>
4040
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
41-
<HintPath>..\packages\NLog.4.3.4\lib\net45\NLog.dll</HintPath>
41+
<HintPath>..\packages\NLog.4.3.7\lib\net45\NLog.dll</HintPath>
4242
<Private>True</Private>
4343
</Reference>
4444
<Reference Include="System" />

WebDriverManager/WebDriverManager.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1212
<description>$description$</description>
1313
<summary>$description$</summary>
14-
<releaseNotes>Change repository and name of new firefox driver (wires > geckodriver)</releaseNotes>
14+
<releaseNotes>Update edge driver home page. Fix marionette driver download link.</releaseNotes>
1515
<copyright>Copyright © Alexander Rosolko 2016</copyright>
1616
<tags>Selenium WebDriver ChromeDriver EdgeDriver InternetExplorerDriver MarionetteDriver OperaDriver PhantomJsDriver AppiumDriver</tags>
1717
</metadata>

WebDriverManager/packages.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net452" />
4-
<package id="NLog" version="4.3.4" targetFramework="net452" />
5-
<package id="NLog.Config" version="4.3.4" targetFramework="net452" />
6-
<package id="NLog.Schema" version="4.3.4" targetFramework="net452" />
3+
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net452" />
4+
<package id="NLog" version="4.3.7" targetFramework="net452" />
5+
<package id="NLog.Config" version="4.3.7" targetFramework="net452" />
6+
<package id="NLog.Schema" version="4.3.7" targetFramework="net452" />
77
</packages>

0 commit comments

Comments
 (0)