microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
521 stars 288 forks source link

[BUG] `UCI.SubGrid.GetSubGridItemsCount(String subgridName)` fails when no records #1318

Open tdashworth opened 2 years ago

tdashworth commented 2 years ago

Bug Report

Issues should only be created for items related to covered functionality.

Not covered functionality, feature requests, and questions should use the Feature Request or Question templates.

EasyRepro Version

UCI or Classic Web

Online or On Premise

Browser

Describe the bug

Microsoft.Dynamics365.UIAutomation.Api.UCI.SubGrid.GetSubGridItemsCount(String subgridName) fails with the following error when there are no records:

...threw exception:
OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":".//div[@class='ag-center-cols-viewport']//div[@role='rowgroup']"}
(Session info: headless chrome=104.0.5112.102)
   at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand`1.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.BrowserCommand`1.Execute(IWebDriver driver)
   at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func`2 delegate)
   at Microsoft.Dynamics365.UIAutomation.Api.UCI.SubGrid.GetSubGridItemsCount(String subgridName)

Special formatting / display

No

Code to reproduce

xrmApp.OnlineLogin.Login(_xrmUri, _username, _password);

xrmApp.Navigation.OpenApp(UCIAppName.Sales);

xrmApp.Entity.OpenEntity("contact", recordGuid);

xrmApp.Entity.SubGrid.GetSubGridItemsCount("nameOfSubgrid");

Expected behavior

A count of 0 returned.