BotSharp/src/Plugins/BotSharp.Plugin.WebDriver/Services/WebDriverService.AssembleMarkup.cs

34 lines
823 B
C#
Raw Normal View History

2024-01-27 14:58:51 +00:00
using BotSharp.Plugin.WebDriver.LlmContexts;
namespace BotSharp.Plugin.WebDriver.Services;
public partial class WebDriverService
{
internal string AssembleMarkup(string tagName, MarkupProperties properties)
{
var html = $"<{tagName}";
if (!string.IsNullOrEmpty(properties.Id))
{
html += $" id=\"{properties.Id}\"";
}
if (!string.IsNullOrEmpty(properties.Name))
{
html += $" name=\"{properties.Name}\"";
}
if (!string.IsNullOrEmpty(properties.Type))
{
html += $" type=\"{properties.Type}\"";
}
if (!string.IsNullOrEmpty(properties.Text))
{
html += $">{properties.Text}</{tagName}>";
return html;
}
return html + $"></{tagName}>";
}
}