microsoft / EasyRepro

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

Lookup SetValue - input cannot be null #1315

Open KNC69 opened 1 year ago

KNC69 commented 1 year ago

I have this line of Code working perfectly in my local xrmApp.Entity.SetValue(new LookupItem() { Name = "entitybox", Value = "Letter" });

When deployed the same code via Devops, im getting input cannot be null. Here is the full error message

System.ArgumentNullException: input cannot be null Parameter name: input 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.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func2 delegate) at FD365.Base_Forms.PageLead.CreateLeadAndNavigateToOpportunitiesGrid(WebClient client, XrmApp xrmApp) in C:\agent-e2e_work\5\s\FD365\Base Forms\PageLead.cs:line 30 at FD365.CreateLead.CreateFLead() in C:\agent-e2e_work\5\s\FD365\D365\Main Script\FLead.cs:line 50

Can anyone help me out please.

This lookup value is setting for other fields.

Shakevg commented 1 year ago

KNC69 Such an error usually means that you are trying to perform some operation (click, FindElement, ....) on the element that was not found. Maybe some control did not load on DevOps before you try to set the value. Did you try to add some additional waiter or just Thread.Sleep?

Also, Stack Trace shows that issue is not with xrmApp.Entity.SetValue, could you post all code snippets?

KNC69 commented 1 year ago

When I took the screenshot before the Lookup SetValue, I can see the Control Exist.

            string screenShot = string.Format("{0}\\CreateNew.jpeg", TestContext.TestResultsDirectory);
            client.Browser.TakeWindowScreenShot(screenShot, ScreenshotImageFormat.Jpeg);
            TestContext.AddResultFile(screenShot);

           xrmApp.Entity.SetValue(new LookupItem() { Name = "entitybox", Value = "Letter" });
KNC69 commented 1 year ago

System.InvalidOperationException: Unable to click element. 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.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func2 delegate)

At this Line
var client = new WebClient(TestSettings.Options); using (var xrmApp = new XrmApp(client))

When I took the screenshot its a complete WhiteScreen .

This is Working fine in LOCAL but failing in Devops.

Can anyone help me out please