Skip to content

Commit 6d3cf4f

Browse files
authored
Browser WBT on Chrome: avoid "no such window: target window already closed" (#1265)
* Avoid "no such window: target window already closed" exception. * Give the browser 1 sec before re-checking if `driverService` is finished. * Feedback, allow delay cancellation.
1 parent 9e5f5af commit 6d3cf4f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Microsoft.DotNet.XHarness.CLI/Commands/WASM/Browser/WasmTestBrowserCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ protected override async Task<ExitCode> InvokeInternal(ILogger logger)
127127
driver.SwitchTo().Window(lastWindowHandle);
128128
}
129129
}
130+
await Task.Delay(TimeSpan.FromSeconds(1), cts.Token);
130131
if (driverService.IsRunning)
131132
{
132-
if (!cts.IsCancellationRequested)
133+
if (!cts.IsCancellationRequested && driver.WindowHandles.Count != 0)
133134
{
134135
driver.Navigate().GoToUrl("about:config");
135136
driver.Navigate().GoToUrl("about:blank");

0 commit comments

Comments
 (0)