0

currently I am writing an automation test of desktop application and I have a moment where I have to set some parameters using arrow keys but the problem is with different kind of fields. If I have field to provide a text value and I use down arrow it will go to the next field but if I have combobox and I will provide a value and press down arrow it will change a value of that parameter. I have to distinguish two types of that fields and if it is combobox I have to use tab but if it is normal field I will use down arrow.

Question: how to distinguish these two types? all fields using inspect or UISpy are the same apart from field name (LegacyIAccessible.Name)

I have tried UISpy and inspect to scan there fields but they are vary from each other only by LegacyIAccessible.Name so with that I can't recognize if it is combobox

I have tried UISpy and inspect to scan there fields but they are vary from each other only by LegacyIAccessible.Name so with that I can't recognize if it is combobox

table which needs to be filled with some data and changing the row should be done by using arrows or tabulators

that is what inspect is showing hovering up a combobox

that is what inspect is showing hovering up a field

my problem is that once I need to use down arrow and once I need to use tabulator but I do not know how to inform computer one field is combobox and one field is text field.

    private void SetAlterParamsByKeyboard()
    {



        WindowsElement OkButton = Driver.FindElementByName("ButtonYes");



        PressTabDownUntilFindParameterAndSetValueInComboBox(Driver.FindElementByName("New row 0"), "New row 0", "True");
        PressArrowDownUntilFindParameterAndSetValueInTextField(Driver.FindElementByName("New row 0"), "New row 1", "4");
        PressArrowDownUntilFindParameterAndSetValueInTextField(Driver.FindElementByName("New row 1"), "New row 2", "111");


        PressArrowDownUntilFindParameterAndSetValueInComboBox(Driver.FindElementByName("New row 2"), "New row 19", "Switch Diagnostics Active");
        PressTabDownUntilFindParameterAndSetValueInTextField(Driver.FindElementByName("New row 19"), "New row 30", "25500");
        PressArrowDownUntilFindParameterAndSetValueInTextField(Driver.FindElementByName("New row 30"), "New row 57", "qwertz");
        PressArrowDownUntilFindParameterAndSetValueInTextField(Driver.FindElementByName("New row 57"), "New row 58", "111.0000");
        PressArrowDownUntilFindParameterAndSetValueInComboBox(Driver.FindElementByName("New row 58"), "New row 135", "Enabled");

}

Because of that I can't distinguish type of field i have to do something like this.

kollodziej
  • 11
  • 5
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jun 12 '23 at 08:21
  • are you sure these are 2 different elements .combobox should have a Control Type of "ComboBox" while a text field have a Control Type of "Edit" or "TextBox". if that does not work, check if the fields implement different value patterns. A combobox implement the SelectionPattern, while a text field implement the ValuePattern – Murat Ishenbaev Jun 12 '23 at 22:01

0 Answers0