Skip to content

Commit a48ba16

Browse files
committed
Fix issue #3 and typos
1 parent 03f0265 commit a48ba16

15 files changed

+68
-67
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ Then you can let WebDriverManager.Net to do manage WebDriver binaries for your a
6060
}
6161

6262
[Test]
63-
public void Test() {
63+
public void Test()
64+
{
6465
// Using Selenium WebDriver to carry out automated web testing
6566
}
6667
}

WebDriverManager/BrowserManagers/AppiumDriverManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class AppiumDriverManager : Logging, IBaseBrowserManager
1919
Binary = "appium-installer.exe",
2020
Url = "https://bitbucket.org/appium/appium.app/downloads/AppiumForWindows_<version>.zip",
2121
PathVariable = "appium.binary.path",
22-
Architecture = Architecture.X32.ToString()
22+
Architecture = Architecture.x32.ToString()
2323
};
2424

2525
public string GetLatestVersion()
@@ -63,13 +63,13 @@ public AppiumDriverManager(string version)
6363

6464
public void Init()
6565
{
66-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
66+
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
6767
Base();
6868
}
6969

7070
public void Init(string destination)
7171
{
72-
_config.Destication = destination;
72+
_config.Destination = destination;
7373
Log?.Info($"Set custom appium driver destination path to: '{destination}'");
7474
Base();
7575
}

WebDriverManager/BrowserManagers/ChromeDriverManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ChromeDriverManager : Logging, IBaseBrowserManager
1515
Binary = "chromedriver.exe",
1616
Url = "https://chromedriver.storage.googleapis.com/<version>/chromedriver_win<architecture>.zip",
1717
PathVariable = "webdriver.chrome.driver",
18-
Architecture = Architecture.X32.ToString().Replace("x", "")
18+
Architecture = Architecture.x32.ToString().Replace("x", "")
1919
};
2020

2121
public string GetLatestVersion()
@@ -62,14 +62,14 @@ public ChromeDriverManager(string version)
6262

6363
public void Init()
6464
{
65-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
66-
Log?.Debug($"Use default chrome driver destination path: '{_config.Destication}'");
65+
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
66+
Log?.Debug($"Use default chrome driver destination path: '{_config.Destination}'");
6767
Base();
6868
}
6969

7070
public void Init(string destination)
7171
{
72-
_config.Destication = destination;
72+
_config.Destination = destination;
7373
Log?.Info($"Set custom chrome driver destination path to: '{destination}'");
7474
Base();
7575
}

WebDriverManager/BrowserManagers/EdgeDriverManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class EdgeDriverManager : Logging, IBaseBrowserManager
1414
Binary = "MicrosoftWebDriver.exe",
1515
Url = string.Empty,
1616
PathVariable = "webdriver.edge.driver",
17-
Architecture = Architecture.X32.ToString()
17+
Architecture = Architecture.x32.ToString()
1818
};
1919

2020
public string GetLatestVersion()
@@ -27,7 +27,7 @@ public string GetLatestVersion()
2727
var htmlCode =
2828
client.DownloadString("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver");
2929
doc.LoadHtml(htmlCode);
30-
var itemList = doc.DocumentNode.SelectNodes("//ul[contains(@class, 'subsection__body')]//p[2]")
30+
var itemList = doc.DocumentNode.SelectNodes("//*[@class='driver-download']/p")
3131
.Select(p => p.InnerText).ToList();
3232
var version = itemList.FirstOrDefault()?.Split(' ')[1].Split(' ')[0];
3333
Log?.Info($"Latest edge driver version is '{version}'");
@@ -51,7 +51,7 @@ public string GetDownloadUrl()
5151
var htmlCode =
5252
client.DownloadString("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver");
5353
doc.LoadHtml(htmlCode);
54-
var itemList = doc.DocumentNode.SelectNodes("//ul[contains(@class, 'subsection__body')]//p[1]/a")
54+
var itemList = doc.DocumentNode.SelectNodes("//*[@class='driver-download']/a")
5555
.Select(p => p.GetAttributeValue("href", null)).ToList();
5656
var url = itemList.FirstOrDefault();
5757
Log?.Info($"Edge driver download url is '{url}'");
@@ -73,13 +73,13 @@ public EdgeDriverManager()
7373

7474
public void Init()
7575
{
76-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
76+
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
7777
Base();
7878
}
7979

8080
public void Init(string destination)
8181
{
82-
_config.Destication = destination;
82+
_config.Destination = destination;
8383
Log?.Debug($"Set custom edge driver destination path to: '{destination}'");
8484
Base();
8585
}

WebDriverManager/BrowserManagers/InternetExplorerDriverManager.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class InternetExplorerDriverManager : Logging, IBaseBrowserManager
1414
Binary = "IEDriverServer.exe",
1515
Url = "http://selenium-release.storage.googleapis.com/<release>/IEDriverServer_<architecture>_<version>.zip",
1616
PathVariable = "webdriver.ie.driver",
17-
Architecture = Architecture.X32.ToString().Replace("x", "Win")
17+
Architecture = Architecture.x32.ToString().Replace("x", "Win")
1818
};
1919

2020
public string GetLatestVersion()
@@ -26,7 +26,7 @@ public string GetLatestVersion()
2626
var doc = new HtmlDocument();
2727
var htmlCode = client.DownloadString("http://www.seleniumhq.org/download");
2828
doc.LoadHtml(htmlCode);
29-
var itemList = doc.DocumentNode.SelectNodes("(//div[@id='mainContent']/p)[6]")
29+
var itemList = doc.DocumentNode.SelectNodes("(//div[@id='mainContent']/p)[7]")
3030
.Select(p => p.InnerText).ToList();
3131
var version = itemList.FirstOrDefault()?.Split(' ')[2];
3232
Log?.Info($"Latest internet explorer driver version is '{version}'");
@@ -94,14 +94,14 @@ private void SetArchitecture(Architecture architecture)
9494
{
9595
switch (architecture)
9696
{
97-
case Architecture.X32:
97+
case Architecture.x32:
9898
{
99-
_config.Architecture = Architecture.X32.ToString().Replace("x", "Win");
99+
_config.Architecture = Architecture.x32.ToString().Replace("x", "Win");
100100
break;
101101
}
102-
case Architecture.X64:
102+
case Architecture.x64:
103103
{
104-
_config.Architecture = Architecture.X64.ToString();
104+
_config.Architecture = Architecture.x64.ToString();
105105
break;
106106
}
107107
default:
@@ -113,13 +113,13 @@ private void SetArchitecture(Architecture architecture)
113113

114114
public void Init()
115115
{
116-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
116+
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
117117
Base();
118118
}
119119

120120
public void Init(string destination)
121121
{
122-
_config.Destication = destination;
122+
_config.Destination = destination;
123123
Log?.Info($"Set custom internet explorer driver destination path to: '{destination}'");
124124
Base();
125125
}

WebDriverManager/BrowserManagers/MarionetteDriverManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class MarionetteDriverManager : Logging, IBaseBrowserManager
1818
Binary = "geckodriver.exe",
1919
Url = "https://github.com/mozilla/geckodriver/releases/download/v<version>/geckodriver-v<version>-win64.zip",
2020
PathVariable = "webdriver.gecko.driver",
21-
Architecture = Architecture.X64.ToString()
21+
Architecture = Architecture.x64.ToString()
2222
};
2323

2424
public string GetLatestVersion()
@@ -57,13 +57,13 @@ public MarionetteDriverManager(string version)
5757

5858
public void Init()
5959
{
60-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
60+
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
6161
Base();
6262
}
6363

6464
public void Init(string destination)
6565
{
66-
_config.Destication = destination;
66+
_config.Destination = destination;
6767
Log?.Info($"Set custom marionette driver destination path to: '{destination}'");
6868
Base();
6969
}

WebDriverManager/BrowserManagers/OperaDriverManager.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ public class OperaDriverManager : Logging, IBaseBrowserManager
1515
Url =
1616
"https://github.com/operasoftware/operachromiumdriver/releases/download/v<version>/operadriver_<architecture>.zip",
1717
PathVariable = "webdriver.opera.driver",
18-
Architecture = Architecture.X32.ToString().Replace("x", "win")
18+
Architecture = Architecture.x32.ToString().Replace("x", "win")
1919
};
2020

2121
public string GetLatestVersion()
2222
{
2323
try
2424
{
25-
using (WebClient client = new WebClient())
25+
using (var client = new WebClient())
2626
{
2727
var doc = new HtmlDocument();
2828
var htmlCode = client.DownloadString("https://github.com/operasoftware/operachromiumdriver/releases");
@@ -69,14 +69,14 @@ private void SetArchitecture(Architecture architecture)
6969
{
7070
switch (architecture)
7171
{
72-
case Architecture.X32:
72+
case Architecture.x32:
7373
{
74-
_config.Architecture = Architecture.X32.ToString().Replace("x", "win");
74+
_config.Architecture = Architecture.x32.ToString().Replace("x", "win");
7575
break;
7676
}
77-
case Architecture.X64:
77+
case Architecture.x64:
7878
{
79-
_config.Architecture = Architecture.X64.ToString().Replace("x", "win");
79+
_config.Architecture = Architecture.x64.ToString().Replace("x", "win");
8080
break;
8181
}
8282
default:
@@ -88,13 +88,13 @@ private void SetArchitecture(Architecture architecture)
8888

8989
public void Init()
9090
{
91-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
91+
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
9292
Base();
9393
}
9494

9595
public void Init(string destination)
9696
{
97-
_config.Destication = destination;
97+
_config.Destination = destination;
9898
Log?.Info($"Set custom opera driver destination path to: '{destination}'");
9999
Base();
100100
}

WebDriverManager/BrowserManagers/PhantomJsDriverManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class PhantomJsDriverManager : Logging, IBaseBrowserManager
1717
Binary = "phantomjs.exe",
1818
Url = "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-<version>-windows.zip",
1919
PathVariable = "phantomjs.binary.path",
20-
Architecture = Architecture.X32.ToString().Replace("x", "")
20+
Architecture = Architecture.x32.ToString().Replace("x", "")
2121
};
2222

2323
public string GetLatestVersion()
@@ -58,13 +58,13 @@ public PhantomJsDriverManager(string version)
5858

5959
public void Init()
6060
{
61-
_config.Destication = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
61+
_config.Destination = Path.Combine(Directory.GetCurrentDirectory(), WebDriverManagerConfig.DefaultDestinationFolder);
6262
Base();
6363
}
6464

6565
public void Init(string destination)
6666
{
67-
_config.Destication = destination;
67+
_config.Destination = destination;
6868
Log?.Info($"Set custom phantomjs driver destination path to: '{destination}'");
6969
Base();
7070
}

WebDriverManager/Helpers/Architecture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
public enum Architecture
44
{
5-
X32 = 32,
6-
X64 = 64
5+
x32 = 32,
6+
x64 = 64
77
}
88
}

WebDriverManager/Helpers/WebDriverManager.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ public static class WebDriverManager
1111
{
1212
private static readonly Logger HLog = LogManager.GetCurrentClassLogger();
1313

14-
private static string DesticationFolder { get; set; }
14+
private static string DestinationFolder { get; set; }
1515

16-
private static string DesticationZip { get; set; }
16+
private static string DestinationZip { get; set; }
1717

18-
private static string DesticationFile { get; set; }
18+
private static string DestinationFile { get; set; }
1919

2020
private static string Zip { get; set; }
2121

@@ -94,14 +94,14 @@ public static void Download(WebDriverManagerConfig config)
9494
Zip = ZipFileName(url);
9595
var bin = Path.GetFileNameWithoutExtension(config.Binary);
9696
if (bin != null)
97-
DesticationFolder = Path.Combine(config.Destication, bin, config.Version, config.Architecture);
98-
DesticationZip = Path.Combine(DesticationFolder, Zip);
99-
DesticationFile = Path.Combine(DesticationFolder, config.Binary);
97+
DestinationFolder = Path.Combine(config.Destination, bin, config.Version, config.Architecture);
98+
DestinationZip = Path.Combine(DestinationFolder, Zip);
99+
DestinationFile = Path.Combine(DestinationFolder, config.Binary);
100100
try
101101
{
102-
if (File.Exists(DesticationFile)) return;
103-
PrepareCatalogs(DesticationFolder);
104-
webClient.DownloadFile(url, DesticationZip);
102+
if (File.Exists(DestinationFile)) return;
103+
PrepareCatalogs(DestinationFolder);
104+
webClient.DownloadFile(url, DestinationZip);
105105
}
106106
catch (Exception ex)
107107
{
@@ -119,17 +119,17 @@ public static void Unzip(WebDriverManagerConfig config)
119119
{
120120
try
121121
{
122-
DesticationFile = Path.Combine(DesticationFolder, config.Binary);
122+
DestinationFile = Path.Combine(DestinationFolder, config.Binary);
123123

124-
if (!File.Exists(DesticationFile))
124+
if (!File.Exists(DestinationFile))
125125
{
126-
using (var zip = ZipFile.Open(DesticationZip, ZipArchiveMode.Read))
126+
using (var zip = ZipFile.Open(DestinationZip, ZipArchiveMode.Read))
127127
{
128128
foreach (var entry in zip.Entries)
129129
{
130130
if (entry.Name == config.Binary)
131131
{
132-
entry.ExtractToFile(DesticationFile);
132+
entry.ExtractToFile(DestinationFile);
133133
}
134134
}
135135
}
@@ -152,8 +152,8 @@ public static void Clean()
152152
{
153153
try
154154
{
155-
if (File.Exists(DesticationZip))
156-
File.Delete(DesticationZip);
155+
if (File.Exists(DestinationZip))
156+
File.Delete(DestinationZip);
157157
}
158158
catch (Exception ex)
159159
{
@@ -172,8 +172,8 @@ public static void AddEnvironmentVariable(string variable)
172172
try
173173
{
174174
var variableValue = Environment.GetEnvironmentVariable(variable);
175-
if (variableValue == null || !variableValue.Equals(DesticationFolder))
176-
Environment.SetEnvironmentVariable(variable, DesticationFolder, EnvironmentVariableTarget.Machine);
175+
if (variableValue == null || !variableValue.Equals(DestinationFolder))
176+
Environment.SetEnvironmentVariable(variable, DestinationFolder, EnvironmentVariableTarget.Machine);
177177
}
178178
catch (Exception ex)
179179
{
@@ -198,7 +198,7 @@ public static void UpdatePath(string variable, bool extendPath = false)
198198
var newPathVariable = pathVariable +
199199
(pathVariable != null && pathVariable.EndsWith(";") ? string.Empty : ";") +
200200
$@"%{variable}%";
201-
if (pathVariable != null && !pathVariable.Contains(DesticationFolder) &&
201+
if (pathVariable != null && !pathVariable.Contains(DestinationFolder) &&
202202
!pathVariable.Contains(variable))
203203
Environment.SetEnvironmentVariable(newPathVariable, name, EnvironmentVariableTarget.Machine);
204204
}
@@ -217,12 +217,12 @@ public static void Install(string command)
217217
{
218218
try
219219
{
220-
if (!File.Exists(DesticationFile) || !IsNew) return;
220+
if (!File.Exists(DestinationFile) || !IsNew) return;
221221
var startInfo = new ProcessStartInfo
222222
{
223223
UseShellExecute = false,
224224
WindowStyle = ProcessWindowStyle.Hidden,
225-
FileName = DesticationFile,
225+
FileName = DestinationFile,
226226
Arguments = command
227227
};
228228
var process = new Process
@@ -236,11 +236,11 @@ public static void Install(string command)
236236
{
237237
HLog.Error(ex,
238238
"Error occurred during application installation " +
239-
$"from file '{DesticationFile}' " +
239+
$"from file '{DestinationFile}' " +
240240
$"using command '{command}'");
241241
throw new WebDriverManagerException(
242242
"Error occurred during application installation " +
243-
$"from file '{DesticationFile}' " +
243+
$"from file '{DestinationFile}' " +
244244
$"using command '{command}'",
245245
ex);
246246
}

0 commit comments

Comments
 (0)