Skip to content

Commit 77b730e

Browse files
committed
Assign driverServiceProcess before polling for process running
1 parent 9b20295 commit 77b730e

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

dotnet/src/webdriver/DriverService.cs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,6 @@ public async Task StartAsync()
239239
{
240240
if (this.driverServiceProcess != null)
241241
{
242-
bool serviceAvailable = await this.WaitForServiceInitializationAsync().ConfigureAwait(false);
243-
if (!serviceAvailable)
244-
{
245-
throw new WebDriverException($"Cannot start the driver service on {this.ServiceUrl}");
246-
}
247-
248242
return;
249243
}
250244

@@ -274,14 +268,6 @@ public async Task StartAsync()
274268
this.OnDriverProcessStarting(eventArgs);
275269

276270
driverServiceProcess.Start();
277-
bool serviceAvailable = await this.WaitForServiceInitializationAsync().ConfigureAwait(false);
278-
DriverProcessStartedEventArgs processStartedEventArgs = new DriverProcessStartedEventArgs(driverServiceProcess);
279-
this.OnDriverProcessStarted(processStartedEventArgs);
280-
281-
if (!serviceAvailable)
282-
{
283-
throw new WebDriverException($"Cannot start the driver service on {this.ServiceUrl}");
284-
}
285271
}
286272
catch
287273
{
@@ -290,6 +276,15 @@ public async Task StartAsync()
290276
}
291277

292278
this.driverServiceProcess = driverServiceProcess;
279+
280+
bool serviceAvailable = await this.WaitForServiceInitializationAsync().ConfigureAwait(false);
281+
DriverProcessStartedEventArgs processStartedEventArgs = new DriverProcessStartedEventArgs(driverServiceProcess);
282+
this.OnDriverProcessStarted(processStartedEventArgs);
283+
284+
if (!serviceAvailable)
285+
{
286+
throw new WebDriverException($"Cannot start the driver service on {this.ServiceUrl}");
287+
}
293288
}
294289

295290
/// <summary>

0 commit comments

Comments
 (0)