Completed
Last Updated: 06 Nov 2014 15:38 by ADMIN
ADMIN
Vera
Created on: 09 Oct 2014 10:17
Category: GridView
Type: Bug Report
1
GridViewCell edit controls cannot be found by AutomationID when executing tests
The problem was initially reproduced by TestStudio users. It can also be reproduced with a codedUI test where the editor is searched by its AutomationID.

Error Message:

Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details: 
TechnologyName:  'UIA'
ControlType:  'Text'
AutomationId:  'CellElement_2_1'
1 comment
ADMIN
Maya
Posted on: 06 Nov 2014 15:36
The solution is to disable the automation peers with the help of AutomationManager ( http://www.telerik.com/help/wpf/common-ui-automation.html) - functionality available from Q2 2014 SP. Thus the AutomationID will not be set while recording the test and on the playback all criteria will match.

The reason for the behavior is that when a test is recorded, the first thing which is taken as search criterion is the AutomationID. The peer of the cell is invoked, the override of GetAutomationId method is called and the AutomationId is assigned to the editing element. When the test is playbacked, GetAutomationID method is not called again and the elements do not have their AutomationID-s being set. As a result, when they are searched for, they cannot be found.