Skip to content

Commit

Permalink
Implementing ICommandExecutor's ExecuteAsync() and using it in Execute()
Browse files Browse the repository at this point in the history
I think this *should* fix it in Selenium 4.22+, but its untested so far of course. :)
  • Loading branch information
kelmelzer authored Jul 2, 2024
1 parent 1132ec7 commit 0d878bd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Appium.Net/Appium/Service/AppiumCommandExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using OpenQA.Selenium.Remote;
using System;
using System.Threading.Tasks;

namespace OpenQA.Selenium.Appium.Service
{
Expand Down Expand Up @@ -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<Response> 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);
Expand Down

0 comments on commit 0d878bd

Please sign in to comment.