AutomationID

Aug 8, 2008 at 9:10 PM
hi, i try get a control by his AutomationID, bu i found one problem: the AutomationID always change everytime i close and open the form

when i try with windows calculator, i see that  button with text "+", always have the same AutomationID =92. if i make an Application that get a control by AutomationID, its going to get an error, because its changes, how can i solve this problem!!

// Get a reference to the Edit TextBox (AutomationId = "403")
TextBox textBox = (TextBox)window.Get(SearchCriteria.ByAutomationId("403"));

Thanks!!!
Aug 11, 2008 at 6:15 AM
I also noticed the same issue when testing Borland VCL based app.
For me workaround is use indexing here, and filtering by control type, but not useful when testing lot of controls.
Coordinator
Aug 11, 2008 at 7:41 PM
You can find controls by text, which would not help for textbox but for button having text as "+" you can do this.
window.Get<Button>(SearchCriteria.ByText("+")).