BotSharp/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.GetAttributeValue.cs
2024-03-22 14:12:45 -05:00

19 lines
598 B
C#

namespace BotSharp.Plugin.WebDriver.Drivers.PlaywrightDriver;
public partial class PlaywrightWebDriver
{
public async Task<string> GetAttributeValue(MessageInfo message, ElementLocatingArgs location, BrowserActionResult result)
{
var page = _instance.GetPage(message.ConversationId);
ILocator locator = page.Locator(result.Selector);
var value = string.Empty;
if (!string.IsNullOrEmpty(location?.AttributeName))
{
value = await locator.GetAttributeAsync(location.AttributeName);
}
return value ?? string.Empty;
}
}