Question

I'm developing a Coded UI test project with Visual Studio 2012 for a WPF application. Is there a way to query and store a value from a control to use in future test in a test suite. The applications creates item ids that I want to use to display the item.

Was it helpful?

Solution

I'm answering my own question. I was over thinking the issue. I manually created a wpftext control with the appropriate search criteria and took the text value of the control. The same way the code generator defines the controls.

        private WpfText _LoadNumberText = null;
        public WpfText LoadNumberText
        {
            get
            {
                if ((this._LoadNumberText == null))
                {
                    this._LoadNumberText = new WpfText(this.UIGradeStarpoweredbyExWindow.UIItemCustom2.UIItemCustom1);
                    #region Search Criteria
                    this._LoadNumberText.SearchProperties[WpfText.PropertyNames.AutomationId] = "DocNumber";
                    this._LoadNumberText.WindowTitles.Contains("Window Title");
                    #endregion
                }
                return this._LoadNumberText;
            }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top