【发布时间】:2014-11-28 00:33:48
【问题描述】:
我需要捕获打开的对话框的屏幕截图,其中突出显示了特定的 html 控件(其静态 id 已给出)。目前我实现了以下方式的代码:
public void Snapshot()
{
Image currentImage = null;
currentImage = GetOpenedDialogFrame().CaptureImage();
}
public UITestControl GetOpenedDialogFrame()
{
var dialogsFrames = new HtmlDiv(this.BrowserMainWindow.UiMobiControlDocument);
dialogsFrames.SearchProperties.Add(new PropertyExpression(HtmlControl.PropertyNames.Class, "mcw-dialog", PropertyExpressionOperator.Contains));
var dialogs = dialogsFrames.FindMatchingControls();
if (dialogs.Count == 0)
{
return null;
}
return dialogs[dialogs.Count - 1];
}
现在我必须编写代码以在截屏时突出显示特定的 html 控件。 Microsoft.VisualStudio.TestTools.UITesting.dll 的 DrawHighlight() 方法不带任何参数,所以如何在屏幕截图中突出显示特定的 html 控件。
【问题讨论】:
标签: c# coded-ui-tests