将自动生成的代码从UIMap.Designer.cs复制到UIMap.cs后出现以下错误
'Test_7.UIReviewyourshoppingcaDocument.UIDJComboBox'和'Test_7.UIReviewyourshoppingcaDocument.UIDJComboBox'之间的歧义
我在encodeUITestMethod中的以下代码行中收到此错误 -
Mouse.Click(this.UIMap.UIReviewyourshoppingcaWindow.UIReviewyourshoppingcaDocument.UIDJComboBox);
我想为我的编码UI测试创建自定义代码,但由于此错误,我无法这样做。
以下是我在UIMap.cs文件中移动的代码 -
public class UIReviewyourshoppingcaDocument : HtmlDocument
{
#region Properties
public HtmlComboBox UIDJComboBox
{
get
{
if ((this.mUIDJComboBox1 == null))
{
this.mUIDJComboBox1 = new HtmlComboBox(this);
#region Search Criteria
this.mUIDJComboBox1.SearchProperties[HtmlComboBox.PropertyNames.Name] = "DJ";
this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.LabeledBy] = null;
this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.Size] = "0";
this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.Title] = "D J";
this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.ItemCount] = "52";
this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.Class] = "form-control control-width form-select DJ-required";
this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.ControlDefinition] = "name=\"DJ\" title=\"Dms";
this.mUIDJComboBox1.FilterProperties[HtmlComboBox.PropertyNames.TagInstance] = "2";
this.mUIDJComboBox1.WindowTitles.Add("Review your shopping cart");
#endregion
}
return this.mUIDJComboBox1;
}
}
#endregion
#region Fields
private HtmlComboBox mUIDJComboBox1;
#endregion
}
答案 0 :(得分:0)
尝试使用 UI.uitest 文件将方法移至 UIMap.cs 。如果您在保存 UIMap.uitest 文件时手动执行此操作,它将再次生成代码。因此,您会收到Ambiguity的错误。
这是单向任务,因为您可以将方法从 UIMap.cs 移动到 UIMap.designer.cs
有关详情,请参阅此帖子:https://msdn.microsoft.com/en-us/library/gg269473%28v=vs.100%29.aspx