BotSharp/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs

20 lines
592 B
C#
Raw Normal View History

2024-03-08 13:17:36 +00:00
namespace BotSharp.Plugin.WebDriver.Drivers.PlaywrightDriver;
public partial class PlaywrightWebDriver
{
public async Task DoAction(MessageInfo message, ElementActionArgs action, BrowserActionResult result)
{
2024-04-09 03:38:56 +00:00
var page = _instance.GetPage(message.ContextId);
2024-03-08 13:17:36 +00:00
ILocator locator = page.Locator(result.Selector);
2024-04-08 15:09:08 +00:00
if (action.Action == BroswerActionEnum.Click)
2024-03-08 13:17:36 +00:00
{
await locator.ClickAsync();
}
2024-04-08 15:09:08 +00:00
else if (action.Action == BroswerActionEnum.InputText)
{
await locator.FillAsync(action.Content);
}
2024-03-08 13:17:36 +00:00
}
}