2gis / Winium.Desktop

Winium.Desktop is Selenium Remote WebDriver implementation for automated testing of Windows application based on WinFroms and WPF platforms.
Mozilla Public License 2.0
402 stars 140 forks source link

locating rows in data grid #142

Open rashagarhy opened 7 years ago

rashagarhy commented 7 years ago

I have a problem reading the rows in the following data grid. Kindly find below a screenshot of the window and UISpy

datagrid

NickAb commented 7 years ago

Can you please give more info on a problem? Is there any exceptions when trying to find rows? What locators have you tried?

You can try something like

var table = window.findElementByXPath(".//*[@AutomationId='IvwSearchResults']"));
table.findElementsByXPath("./*[contains(@LocalizedControlType, 'item')]")); // it is recommended to replace localized control type with regular control type, but I can not guess control type of rows form the picture

where window is the element that corresponds to the main window of AUT.

rashagarhy commented 7 years ago

Thanks for your reply. I was trying to use ToDataGrid function to access the rows? Is there a way to do that? I also tried the ToMenu function with winium desktop, but i get a Null reference exception. I appreciate you help. Thanks, Rasha

NickAb commented 7 years ago

I do not know about ToDataGrid and ToMenu extensions, they are specific to desktop and I did not work with them. Maybe @skyline-gleb can help you.

viswachaitanya4 commented 7 years ago

@skyline-gleb Hi Gleb, In my current project on windows application automation testing, i am facing an issue with datagrid's, where in i have multiple grids with same property values. I need to perform a drag and drop functionality between them. I tried using tools Inspect and UISpy hoping to find a property value distinguishing those datagrids. Still it did not provide any solution. I am thinking of using Xpath, but i am not sure whether it will work or not, since there is no distinct property value. Can you help me in understanding the xpath more in windows applications, Any help is much appreciated. Thanks

locsn commented 5 years ago

@viswachaitanya4 Xpath still work with winium on desktop. You can try xpath as format. //*[@AutomationId='xx' and @LocalizedControlType='yy' and @ClassName='zz']