2

In UI Automation, when automating the toolstrip items we are facing an issue which is described below

I am adding toolstrip items as follows

this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripButton1, this.toolStripButton2, this.toolStripComboBox1, this.toolStripButton3});

When running the UI Automation(System.Windows.Automation), UI automation finds the controls till toolStripButton2 (i.e) controls on the left side of toolstripcombobox is getting recognized but on the controls on the right side.(If i make the combobox to go the right most control everything works fine)

Note: In Inspect.exe tool from windows kits, all the controls are shown but when trying to access the last toolStripButton3 returns null.

Here i have attached the simplified code, the buttonCollection is expected to get 3 buttons but it gets only two in my case.

AutomationElement toolstrip = viewTab.FindFirst(TreeScope.Children,
            new PropertyCondition(AutomationElement.AutomationIdProperty, "toolStrip1"));

        AutomationElementCollection buttonCollection = toolstrip.FindAll(TreeScope.Children,
            new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, "button"));

Both ToolStripTextBox and ToolStripComboBox are showing the same behavior.

I would like know what is going wrong my approach.

Kesavan D
  • 184
  • 5

1 Answers1

0

I've posted one approach which would allow you to access all the buttons, in response to your question at https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/2363de9f-3bf0-48dc-a914-1eef5bcf1482/toolstriptextbox-toolstripcombobox-not-automated?forum=windowsaccessibilityandautomation.

Thanks,

Guy

  • which you have said using Windows UIA API. Meanwhile we have almost completed all our works using .NET UIA API in our application, So we could not roll back & start entire feasibility study & scripting from the scratch. I would like share the workaround which we used in our side based on our application. 1. We have all our toolstrip items with specified bounding rectangle 2. Hence with the last recognizable toolstrip item, we retrieved its bounding rectangle &calculated the following items location 3. We recognized missed toolstrip using AutomationElement.FromPoint() – Kesavan D Oct 13 '15 at 07:01