microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
523 stars 289 forks source link

xrmBrowser.Grid.OpenRecord(0) giving 'CRM Record is Unavailable or not finished loading. Timeout Exceeded' #649

Open bhart24 opened 5 years ago

bhart24 commented 5 years ago

For one of the projects xrmBrowser.Grid.OpenRecord(0) is giving 'CRM Record is Unavailable or not finished loading. Timeout Exceeded' It opens the right record but fails at this line after waiting for some time.

Complete error- {System.Exception: CRM Record is Unavailable or not finished loading. Timeout Exceeded at Microsoft.Dynamics365.UIAutomation.Api.Grid.<>c.b9_1(IWebDriver d) at Microsoft.Dynamics365.UIAutomation.Browser.SeleniumExtensions.WaitUntilClickable(IWebDriver driver, By by, TimeSpan timeout, Action1 successCallback, Action1 failureCallback) at Microsoft.Dynamics365.UIAutomation.Api.Grid.<>c__DisplayClass9_0.b0(IWebDriver driver) 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.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func2 delegate) at TestAuto.pages.CRMMACase.SearchForCaseAndOpenFirstRecord(String CaseTitle) in D:\MAXAuto\MaxTestAuto\TestAuto\pages\CRMMACase.cs:line 200 at TestAuto.steps.StepsCRMMACaseWorkflow.ThenISearchForCaseAndOpenFirstRecord(String CaseTitle) in D:\MAXAuto\MaxTestAuto\TestAuto\steps\StepsCRMMACaseWorkflow.cs:line 118 at TestStack.BDDfy.StepActionFactory.<>cDisplayClass1_0`1.b0(Object o) at TestStack.BDDfy.StepExecutor.Execute(Step step, Object testObject) at TestStack.BDDfy.Processors.ScenarioExecutor.<>cDisplayClass3_0.b0() at TestStack.BDDfy.Processors.AsyncTestRunner.Run(Func`1 performStep) at TestStack.BDDfy.Processors.ScenarioExecutor.ExecuteStep(Step step)}

I have tried xrmBrowser.Grid.OpenRecord(0,15000) but same result. Also tried added xrmBrowser.ThinkTime(15000); after the open record statement but same result. Also tried time out in browser options: private static readonly BrowserOptions _options = new BrowserOptions { BrowserType = BrowserType.Chrome,
FireEvents = true,
CommandTimeout = TimeSpan.FromSeconds(100), PageLoadTimeout = TimeSpan.FromSeconds(100) };

But same result.

Manually screen seem to load in 5 seconds. I have been using xrmBrowser.Grid.OpenRecord(0) for other projects but never had any issues.

Would you be able to advise things to try please ?

Regards, Bhart

bhart24 commented 5 years ago

Following line in openrecord seems to be throwing the error , time out seems to be hardcoded:

driver.WaitUntilClickable(By.XPath(Elements.Xpath[Reference.Entity.Form]), new TimeSpan(0, 0, 30), null, d => { throw new Exception("CRM Record is Unavailable or not finished loading. Timeout Exceeded"); } );

simonbridgwater commented 5 years ago

I'm also encountering this error for one entity only, whereby a record is apparently successfully opened after a few seconds, but still times out. Records for all other entities load ok. I've included error text below, although have redacted some references for privacy.

Result StackTrace:
at Microsoft.Dynamics365.UIAutomation.Api.Grid.<>c.b9_1(IWebDriver d) at Microsoft.Dynamics365.UIAutomation.Browser.SeleniumExtensions.WaitUntilClickable(IWebDriver driver, By by, TimeSpan timeout, Action1 successCallback, Action1 failureCallback) at Microsoft.Dynamics365.UIAutomation.Api.Grid.<>c__DisplayClass9_0.b0(IWebDriver driver) at Microsoft.Dynamics365.UIAutomation.Browser.DelegateBrowserCommand1.ExecuteCommand(IWebDriver driver, Object[] params) 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.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func`2 delegate) at Microsoft.Dynamics365.UIAutomation.Api.Grid.OpenRecord(Int32 index, Int32 thinkTime) at [Redacted].Actions.OpenFirstResult(String sortField, Boolean sortTypeDesc) in [Redacted]\Actions.cs:line 95 at [Redacted].Record.OpenFirstResult() in [Redacted]\Record.cs:line 896 at [Redacted].TestFormBasics.UpdateRecord() in [Redacted]\TestFormBasics.cs:line 45 Result Message: Test method [Redacted].TestFormBasics.UpdateRecord threw exception: System.Exception: CRM Record is Unavailable or not finished loading. Timeout Exceeded