Bug 540889 - AutomationId is not implemented as what Microsoft did
Summary: AutomationId is not implemented as what Microsoft did
Status: NEW
Alias: None
Product: UI Automation
Classification: Mono
Component: Winforms - UIA (show other bugs)
Version: Unspecified
Hardware: Other Other
: P5 - None : Normal
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-22 03:43 UTC by Rui Guo
Modified: 2009-09-22 03:45 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rui Guo 2009-09-22 03:43:33 UTC
On Windows/MS .Net, for a winform control, the
AutomationElement.AutomationId is the name of the winform control.

So I can use following code to find a TextBox control whose name is
"txtCommand":

var txtCommand = win.FindFirst(TreeScope.Children,
               new
PropertyCondition(AutomationElementIdentifiers.AutomationIdProperty,
                   "txtCommand"));

But with our implementation, the AutomationId becomes a integer like
"2" or "15" etc, and the former search will fail to find the textbox.

BTW, since in most cases a TextBox's NameProperty is an empty string,
therefore it becomes difficult to find a TextBox without the help of
AutomationId.
Comment 1 Rui Guo 2009-09-22 03:45:04 UTC
Realted mono-a11y emails:

[Matt, Sep 18]
Hey, all

On Windows/MS .Net, for a winform control, the
AutomationElement.AutomationId is the name of the winform control.

So I can use following code to find a TextBox control whose name is
"txtCommand":

var txtCommand = win.FindFirst(TreeScope.Children,
               new
PropertyCondition(AutomationElementIdentifiers.AutomationIdProperty,
                   "txtCommand"));

But with our implementation, the AutomationId becomes a integer like
"2" or "15" etc, and the former search will fail to find the textbox.
So is it OK for us to implement AutomationId like this?

BTW, since in most cases a TextBox's NameProperty is an empty string,
therefore it becomes difficult to find a TextBox without the help of
AutomationId.

[Sandy, Sep 19]
Matt,

Please file a bug about this so we can fix it in UIAutomationWinforms.

Both AutomationId and RuntimeId are incorrectly implemented there.
Also, we have code (maybe in UiaAtkBridge, too) that assumes
AutomationId should be unique (that code should instead use
RuntimeId).  From MSDN:

"The AutomationIdProperty of an element is always the same in any
instance of the application on any machine, regardless of the local
language. If the property is supported by the element, the value is
unique among sibling elements but not necessarily unique on the
desktop. For example, multiple instances of an application, or
multiple folder views in Microsoft Windows Explorer, may contain
elements with the same AutomationIdProperty, such as "SystemMenuBar".

Instances of user interface (UI) elements are uniquely identified on
the desktop by their RuntimeIdProperty properties."