Skip to content

Commit 8ea2b30

Browse files
committed
Fix issue when service is shared and browser is not installed
1 parent e9626e6 commit 8ea2b30

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

dotnet/src/webdriver/Chromium/ChromiumDriver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,13 @@ protected static IReadOnlyDictionary<string, CommandInfo> ChromiumCustomCommands
148148

149149
private static ICommandExecutor StartDriverServiceCommandExecutor(DriverService service, DriverOptions options, TimeSpan commandTimeout)
150150
{
151-
if (service.DriverServicePath == null)
151+
if (service.DriverServicePath == null || string.IsNullOrEmpty(options.BinaryLocation))
152152
{
153153
DriverFinder finder = new DriverFinder(options);
154154
string fullServicePath = finder.GetDriverPath();
155155
service.DriverServicePath = Path.GetDirectoryName(fullServicePath);
156156
service.DriverServiceExecutableName = Path.GetFileName(fullServicePath);
157+
157158
if (finder.HasBrowserPath())
158159
{
159160
options.BinaryLocation = finder.GetBrowserPath();

dotnet/src/webdriver/Firefox/FirefoxDriver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,13 @@ private FirefoxDriver(FirefoxDriverService service, bool disposeService, Firefox
214214
/// <returns></returns>
215215
private static ICommandExecutor StartDriverServiceCommandExecutor(DriverService service, DriverOptions options, TimeSpan commandTimeout)
216216
{
217-
if (service.DriverServicePath == null)
217+
if (service.DriverServicePath == null || string.IsNullOrEmpty(options.BinaryLocation))
218218
{
219219
DriverFinder finder = new DriverFinder(options);
220220
string fullServicePath = finder.GetDriverPath();
221221
service.DriverServicePath = Path.GetDirectoryName(fullServicePath);
222222
service.DriverServiceExecutableName = Path.GetFileName(fullServicePath);
223+
223224
if (finder.HasBrowserPath())
224225
{
225226
options.BinaryLocation = finder.GetBrowserPath();

0 commit comments

Comments
 (0)