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

17 lines
451 B
C#
Raw Normal View History

2024-02-06 14:07:09 +00:00
namespace BotSharp.Plugin.WebDriver.Drivers.PlaywrightDriver;
public partial class PlaywrightWebDriver
{
public async Task<string> ScreenshotAsync(string conversationId, string path)
2024-02-06 14:07:09 +00:00
{
var bytes = await _instance.GetPage(conversationId)
.ScreenshotAsync(new PageScreenshotOptions
{
Path = path,
});
2024-02-06 14:07:09 +00:00
2024-02-06 20:42:35 +00:00
return "data:image/png;base64," + Convert.ToBase64String(bytes);
2024-02-06 14:07:09 +00:00
}
}