Couldn't convert WindowsElement as AutomationPeer classes
AmalRajUmapathySelvam opened this issue · comments
I am working on writing a test application with WinAppDriver and Appium for testing WPF Framework controls. While working on this, functionalities provided in the AutomationPeer classes couldn't be tested, since the control is accessed as WindowsElement and the WindowsElement type object couldn't be converted as AutomationPeer classes.
For example, consider we are working on WPF MS DataGrid and the datagrid is accessed through below code functionality.
WindowsElement dataGrid = DataGridAppSession.FindElementByAccessibilityId("dataGrid");
And we are trying to test some basic automation functionalities on DataGrid with finding row and column counts with converting the WindowsElement as IGridProvider or DataGridAutomationPeer
Using IGridProvider conversion:
WindowsElement dataGrid = FrameworkDataGridAppSession.FindElementByAccessibilityId("dataGrid");
IGridProvider dataGridProvider = dataGrid as IGridProvider;
int rowCount = dataGridProvider.RowCount;
int columnCount = dataGridProvider.ColumnCount;
Using DataGridAutomationPeer conversion:
WindowsElement dataGrid = FrameworkDataGridAppSession.FindElementByAccessibilityId("dataGrid");
DataGridAutomationPeer dataGridAutomationPeer = dataGrid as DataGridAutomationPeer;
int rowCount = dataGridAutomationPeer.RowCount;
int columnCount = dataGridAutomationPeer.ColumnCount;
But the above conversions doesn't work and couldn't get the row and column counts of the grid in automation.
Does anyone has idea on why the conversion doesn't work or please share idea on how to work with MS DataGrid for automation testing with API provided in like IGridProvider, ISelectionProvider etc for DataGridAutomationPeer?