Error observed after copying code from UIMap.Designer.cs to UIMap.cs

142 views Asked by At

I am getting following error after copying the auto-generated code from UIMap.Designer.cs to UIMap.cs

Ambiguity between 'Test_7.UIReviewyourshoppingcaDocument.UIDJComboBox' and 'Test_7.UIReviewyourshoppingcaDocument.UIDJComboBox'

I am getting this error on following line of code in my codedUITestMethod -

Mouse.Click(this.UIMap.UIReviewyourshoppingcaWindow.UIReviewyourshoppingcaDocument.UIDJComboBox);

I want to create custom code for my coded UI test, but I am unable to do so due to this error.

Following is the code which i have moved in UIMap.cs file -

    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
    }
1

There are 1 answers

1
Kuldeep Vasani On

Try moving Methods to UIMap.cs using UI.uitest file. if you do it manually whenever your UIMap.uitest file will be saved it will generate code again. for that reason you are getting an error for Ambiguity.

This is the one way task as you can move methods from UIMap.cs to UIMap.designer.cs

refer to this post for more details : https://msdn.microsoft.com/en-us/library/gg269473%28v=vs.100%29.aspx