From da71a9f45ee8be5935775399a84db3566fe66387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 4 Aug 2023 13:27:56 +0200 Subject: [PATCH] Add lock. --- Lombiq.Tests.UI/Services/WebDriverFactory.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lombiq.Tests.UI/Services/WebDriverFactory.cs b/Lombiq.Tests.UI/Services/WebDriverFactory.cs index 2e527bcc1..0df9036cf 100644 --- a/Lombiq.Tests.UI/Services/WebDriverFactory.cs +++ b/Lombiq.Tests.UI/Services/WebDriverFactory.cs @@ -13,6 +13,8 @@ namespace Lombiq.Tests.UI.Services; public static class WebDriverFactory { + private static readonly object _setupLock = new(); + public static ChromeDriver CreateChromeDriver(BrowserConfiguration configuration, TimeSpan pageLoadTimeout) { ChromeDriver CreateDriverInner(ChromeDriverService service) @@ -163,7 +165,7 @@ private static TDriver CreateDriver(string browserName, Func d { try { - DriverSetup.AutoSetUp(browserName); + lock (_setupLock) DriverSetup.AutoSetUp(browserName); return driverFactory(); } catch (Exception ex)