在我的团队中,我们通常使用 Kendo JavaScript API 并将其包装在控件中,例如:
public class KendoColorPicker
{
private readonly string colorPickerSetColorExpression =
"$('#{0}').data('colorpicker').value('#{1}');";
private readonly string idLocator;
public KendoColorPicker(string idLocator)
{
this.idLocator = idLocator;
}
public void SetColor(string hexValue)
{
string scriptToBeExecuted = string.Format(colorPickerSetColorExpression, this.idLocator, hexValue);
Manager.Current.ActiveBrowser.Actions.InvokeScript(scriptToBeExecuted);
}
}
我写了一篇关于它的文章——Advanced Web UI Components Automation with Telerik Testing Framework。我认为您可以使用类似的方法。