From c9c49133ed56022c085d3215585b1d68af72e309 Mon Sep 17 00:00:00 2001 From: kelmelzer Date: Sun, 28 Jul 2024 13:34:04 -0400 Subject: [PATCH] break: ExecuteAsync() under the hood implementation after bumping to Selenium 4.23 (#804) * Update AppiumDriver.cs * Update AppiumCommandExecutor.cs * Update Appium.Net.csproj * Revert "Update Appium.Net.csproj" This reverts commit bb0308a71625f8ee7cca28289fdbc7a01df4d6cc. * Revert "Update AppiumCommandExecutor.cs" This reverts commit c2ebe402cd526c6b775916c9f0fdf3fd7f3de831. * bump to selenium 4.23, added executeasync passthrough impl * Revert "Update AppiumDriver.cs" This reverts commit f7854e3743c9b4028e106cc2aef90ad288657e41. * whoops, missing namespace * fliped around logic for Execute and ExecuteAsync, Execute now passes through to ExecuteAsync * fixed execute and executeasync * Update src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs Co-authored-by: Dor Blayzer <59066376+Dor-bl@users.noreply.github.com> * Update src/Appium.Net/Appium.Net.csproj Co-authored-by: Dor Blayzer <59066376+Dor-bl@users.noreply.github.com> --------- Co-authored-by: Dor Blayzer <59066376+Dor-bl@users.noreply.github.com> --- src/Appium.Net/Appium.Net.csproj | 4 ++-- src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Appium.Net/Appium.Net.csproj b/src/Appium.Net/Appium.Net.csproj index 50729e93..220b7aa9 100644 --- a/src/Appium.Net/Appium.Net.csproj +++ b/src/Appium.Net/Appium.Net.csproj @@ -58,8 +58,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs b/src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs index e06a3374..0e0f7a94 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,18 @@ internal AppiumCommandExecutor(AppiumLocalService service, TimeSpan timeForTheSe } public Response Execute(Command commandToExecute) + { + return Task.Run(() => ExecuteAsync(commandToExecute)).GetAwaiter().GetResult(); + } + + public async Task ExecuteAsync(Command commandToExecute) { Response result = null; try { bool newSession = HandleNewSessionCommand(commandToExecute); - result = RealExecutor.Execute(commandToExecute); + result = await RealExecutor.ExecuteAsync(commandToExecute).ConfigureAwait(false); if (newSession) { RealExecutor = UpdateExecutor(result, RealExecutor);