ControlName не работает для идентичных Wincontrols в codedui

   import sys
print ("enter the string from which you want to remove list of stop words")
userstring = input().split(" ")
list =["a","an","the","in"]
another_list = []
for x in userstring:
    if x not in list:           # comparing from the list and removing it
        another_list.append(x)  # it is also possible to use .remove
for x in another_list:
     print(x,end=' ')

   # 2) if you want to use .remove more preferred code
    import sys
    print ("enter the string from which you want to remove list of stop words")
    userstring = input().split(" ")
    list =["a","an","the","in"]
    another_list = []
    for x in userstring:
        if x in list:           
            userstring.remove(x)  
    for x in userstring:           
        print(x,end = ' ') 
    #the code will be like this
0
задан Rasim Avci 17 January 2019 в 13:46
поделиться

2 ответа

Далее, в ответе Расима Авчи, приведенный ниже код иллюстрирует сгенерированный код из UIMap. Тестируемая программа представляла собой проект Windows Forms, содержащий форму с ComboBox.

[GeneratedCode("Coded UITest Builder", "15.0.26208.0")]
public class UIForm1Window : WinWindow
{

    public UIForm1Window()
    {
        #region Search Criteria
        this.SearchProperties[WinWindow.PropertyNames.Name] = "Form1";
        this.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
        this.WindowTitles.Add("Form1");
        #endregion
    }

    #region Properties
    public UICbStartDateWindow UICbStartDateWindow
    {
        get
        {
            if ((this.mUICbStartDateWindow == null))
            {
                this.mUICbStartDateWindow = new UICbStartDateWindow(this);
            }
            return this.mUICbStartDateWindow;
        }
    }

    public UICbEndDateWindow UICbEndDateWindow
    {
        get
        {
            if ((this.mUICbEndDateWindow == null))
            {
                this.mUICbEndDateWindow = new UICbEndDateWindow(this);
            }
            return this.mUICbEndDateWindow;
        }
    }
    #endregion

    #region Fields
    private UICbStartDateWindow mUICbStartDateWindow;

    private UICbEndDateWindow mUICbEndDateWindow;
    #endregion
}

[GeneratedCode("Coded UITest Builder", "15.0.26208.0")]
public class UICbStartDateWindow : WinWindow
{

    public UICbStartDateWindow(UITestControl searchLimitContainer) : 
            base(searchLimitContainer)
    {
        #region Search Criteria
        this.SearchProperties[WinWindow.PropertyNames.ControlName] = "cbStartDate";
        this.WindowTitles.Add("Form1");
        #endregion
    }

    #region Properties
    public WinComboBox UICbStartDateComboBox
    {
        get
        {
            if ((this.mUICbStartDateComboBox == null))
            {
                this.mUICbStartDateComboBox = new WinComboBox(this);
                #region Search Criteria
                this.mUICbStartDateComboBox.SearchProperties[WinComboBox.PropertyNames.Name] = "cbStartDate";
                this.mUICbStartDateComboBox.WindowTitles.Add("Form1");
                #endregion
            }
            return this.mUICbStartDateComboBox;
        }
    }
    #endregion

    #region Fields
    private WinComboBox mUICbStartDateComboBox;
    #endregion
}

На рисунке ниже показана иерархия управления. Это ясно показывает UICbStartDateWindow как родительский для ComboBox.

enter image description here

Как видите, сгенерированный код должен следовать тому, что описано в ссылке из ответа Расима Авчи. [118 ]

0
ответ дан PixelPlex 17 January 2019 в 13:46
поделиться

Я нашел решение, как описано на странице ниже, controlName не для отдельных элементов управления, а для оконных элементов управления, таких как WinWindow.

https://blogs.msdn.microsoft.com/vstsqualitytools/2010/01/15/understanding-the-window-search-and-windowed-properties/

0
ответ дан Rasim Avci 17 January 2019 в 13:46
поделиться