microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
513 stars 286 forks source link

Grids not working in 9.2 (UCI) Online #1317

Open BigIan1969 opened 1 year ago

BigIan1969 commented 1 year ago

EasyRepro Version

UCI or Classic Web

Online or On Premise

Browser

Describe the bug
When I try to get the count of the currently open grid:

int qty= (xrmApp.Grid.GetGridItems()).Count;

I get the following exception

` Message: no such element: Unable to locate element: {"method":"css selector","selector":".wj-colheaders"} (Session info: chrome=105.0.5195.54)

Source: Microsoft.Dynamics365.UIAutomation.Browser

Stack Trace: at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9) at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.Execute(IWebDriver driver) at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func2 delegate) at Microsoft.Dynamics365.UIAutomation.Api.UCI.WebClient.GetGridItems(Int32 thinkTime) at Microsoft.Dynamics365.UIAutomation.Api.UCI.Grid.GetGridItems() at GenericFramework.StepD365.GetGridCount(Target TargetElement, String data) in C:\Users\sesiho\Source\Repos\BANNER-Test\SLP-SMOKE\GenericFramework\StepD365.cs:line 80 at GenericFramework.Testcase.Steps(String action, String target, String data, String[] rowdata) in C:\Users\sesiho\Source\Repos\BANNER-Test\SLP-SMOKE\GenericFramework\Testcase.cs:line 613 at GenericFramework.Testcase.Execute(String tc, IDictionary2 _vars, IDictionary2 _datalookup, String[] _rowdata, IDictionary2 _reports, List1 _dataoutput) in C:\Users\sesiho\Source\Repos\BANNER-Test\SLP-SMOKE\GenericFramework\Testcase.cs:line 513

Expected behavior
Expected to be given a count of the rows in the grid

Additional context
Am also experiencing issues with:

xrmApp.Grid.OpenRecord(0) However, I suspect this is a related issue

adambarath commented 1 year ago

Hi,

In my opinion it could be fixed by removing //div[@data-automationid='ListCell'] postfix from { "Grid_Rows" , "//div[@data-id='grid-container']//div[@data-automationid='ListCell']"}, at Microsoft.Dynamics365.UIAutomation.Api.UCI.AppElements.Xpath *(Line 414, Commit 031ccfeb )

What do you think? Did Microsoft remove automationids?

aliyoussefi commented 1 year ago

Hi @adambarath I'm looking into the changes between the legacy read only grid, the newer read only and the power apps grid control. The refactored OpenRecord will work for both as long as the view contains the primary field record on the power apps grid control. I'll be checking in a branch soon, will update this comment once completed.