Skip to content

Commit 51d2113

Browse files
committed
Return binary path on setup method call.
Closes #130
1 parent 9e1ede8 commit 51d2113

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

WebDriverManager.Tests/DriverManagerTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.IO;
23
using System.Net;
34
using WebDriverManager.DriverConfigs.Impl;
45
using Xunit;
@@ -22,6 +23,13 @@ public void DownloadZipFileWithProxy()
2223
Assert.True(webProxyStub.IsBypassed(webProxyStub.RequestedUri));
2324
}
2425

26+
[Fact]
27+
public void ReturnPathOnSetup()
28+
{
29+
var driverPath = new DriverManager().SetUpDriver(new FirefoxConfig());
30+
Assert.True(File.Exists(driverPath));
31+
}
32+
2533
private class WebProxyStub : IWebProxy
2634
{
2735
public Uri RequestedUri { get; private set; }

WebDriverManager/DriverManager.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ public DriverManager WithProxy(IWebProxy proxy)
3131
return this;
3232
}
3333

34-
public void SetUpDriver(string url, string binaryPath, string binaryName)
34+
public string SetUpDriver(string url, string binaryPath, string binaryName)
3535
{
3636
var zipPath = FileHelper.GetZipDestination(url);
3737
binaryPath = _binaryService.SetupBinary(url, zipPath, binaryPath, binaryName);
3838
_variableService.SetupVariable(binaryPath);
39+
return binaryPath;
3940
}
4041

41-
public void SetUpDriver(IDriverConfig config, string version = VersionResolveStrategy.Latest,
42+
public string SetUpDriver(IDriverConfig config, string version = VersionResolveStrategy.Latest,
4243
Architecture architecture = Architecture.Auto)
4344
{
4445
lock (Object)
@@ -51,7 +52,7 @@ public void SetUpDriver(IDriverConfig config, string version = VersionResolveStr
5152
url = UrlHelper.BuildUrl(url, version);
5253
var binaryPath = FileHelper.GetBinDestination(config.GetName(), version, architecture,
5354
config.GetBinaryName());
54-
SetUpDriver(url, binaryPath, config.GetBinaryName());
55+
return SetUpDriver(url, binaryPath, config.GetBinaryName());
5556
}
5657
}
5758

0 commit comments

Comments
 (0)