Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't convert WindowsElement as AutomationPeer classes #1970

Open
AmalRajUmapathySelvam opened this issue Feb 2, 2024 · 0 comments
Open

Comments

@AmalRajUmapathySelvam
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant