From 0d878bd17a78de707538670e4d51cc0d16a51f5d Mon Sep 17 00:00:00 2001 From: kelmelzer Date: Tue, 2 Jul 2024 13:42:06 -0400 Subject: [PATCH] Implementing ICommandExecutor's ExecuteAsync() and using it in Execute() I think this *should* fix it in Selenium 4.22+, but its untested so far of course. :) --- src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs b/src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs index e06a3374..28917234 100644 --- a/src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs +++ b/src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs @@ -14,6 +14,7 @@ using OpenQA.Selenium.Remote; using System; +using System.Threading.Tasks; namespace OpenQA.Selenium.Appium.Service { @@ -54,13 +55,19 @@ internal AppiumCommandExecutor(AppiumLocalService service, TimeSpan timeForTheSe } public Response Execute(Command commandToExecute) + { + return Task.Run(() => RealExecutor.ExecuteAsync(commandToExecute)).GetAwaiter().GetResult(); + } + + public async Task ExecuteAsync(Command commandToExecute) { Response result = null; try { bool newSession = HandleNewSessionCommand(commandToExecute); - result = RealExecutor.Execute(commandToExecute); + result = Task.Run(() => RealExecutor.ExecuteAsync(commandToExecute)).GetAwaiter().GetResult(); + if (newSession) { RealExecutor = UpdateExecutor(result, RealExecutor);