2

I am quite new to UI Automation and UI Verify tool.

In our application, we are using System.Windows.Forms.ListView with CheckBoxes property set to true.

The CheckBoxes property allows you to display a check box next to each item in the list. This enables your application to display a list of items (and subitems if the View property is set to View.Details)

So far individual row and all values in each row is identified. Only checkbox is not recognized by UI verify.


namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent()

        listView1.CheckBoxes = true;
        listView1.View = View.Details;
        listView1.Columns.Add("Automation");
        listView1.Columns.Add("result");
        listView1.Items.Add(new ListViewItem(new string[] { "1", "Pass" }));
    }

}

Output: Both values "1" and "pass" are recognized by UIA verify. However the check box is not recognized.


Has anybody else experience similar behavior? and if so is there any fix for this?

Much appreciated for all the help.

Regards Hari Hara

2 Answers2

2

From what I can see the whole list item supports the toggle pattern.

enter image description here

So you should be able to use the toggle pattern of the row control itself.

    /// <summary>
    /// Toggles anything that supports the toggle pattern
    /// </summary>
    /// <param name="aeElement">Automation element to toggle</param>
    public void Toggle(AutomationElement aeElement)
    {
            TogglePattern tpToggle = (TogglePattern)aeElement.GetCurrentPattern(TogglePattern.Pattern);
            tpToggle.Toggle();
    }
Max Young
  • 1,522
  • 1
  • 16
  • 42
  • I had a similar issue, but while using TestStack.White. I altered the code I was writing so that it exposed the underlying AutomationElement, and I was able to get this code working for me. Thanks for posting this. – Shafiq Jetha Sep 26 '17 at 16:37
1

Are you using "hover" mode? Try checking the pane structure near the checkbox items in the left pane of UIA verifier window.

Ronak Agrawal
  • 1,006
  • 1
  • 19
  • 48