microsoft / EasyRepro

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

System.InvalidOperationException: The Office 365 sign in page did not return the expected result and the user 'System.Security.SecureString' could not be signed in. #469

Open yoadster opened 5 years ago

yoadster commented 5 years ago

Hi, using Dynamics Version 1710 (9.1.0.4044) online with the April 2019 updates enabled. The code sample provided has worked flawlessly pre-update.

When the login code runs it does actually log the user in and displays the organisation homepage however the following exception occurs and the test fails

Test Name: Lead_CreateNewLead_SA_MyAccountA2D_Onmicrosoft_Com Test FullName: A2D.DynamicsCE.Tests.Features.Sales.Leads.LeadsFeature.Lead_CreateNewLead_SA_MyAccountA2D_Onmicrosoft_Com Test Source: C:\Users\Lee.Brennan\Documents\Azure DevOps\A2D.DynamicsCE.Tests\A2D.DynamicsCE.Tests\Features\Sales\Leads\Leads.feature : line 22 Test Outcome: Failed Test Duration: 0:00:39.8706294

Result StackTrace:
at Microsoft.Dynamics365.UIAutomation.Browser.SeleniumExtensions.<>c__DisplayClass39_0.b__0(IWebDriver d) at Microsoft.Dynamics365.UIAutomation.Browser.SeleniumExtensions.WaitUntilAvailable(IWebDriver driver, By by, TimeSpan timeout, Action1 successCallback, Action1 failureCallback) at Microsoft.Dynamics365.UIAutomation.Browser.SeleniumExtensions.WaitUntilAvailable(IWebDriver driver, By by, String exceptionMessage) at Microsoft.Dynamics365.UIAutomation.Api.LoginDialog.Login(IWebDriver driver, Uri uri, SecureString username, SecureString password, Action1 redirectAction) at Microsoft.Dynamics365.UIAutomation.Browser.DelegateBrowserCommand5.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.BrowserCommand1.Execute[T1,T2,T3,T4](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4) at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult,T1,T2,T3,T4](BrowserCommandOptions options, Func`6 delegate, T1 p1, T2 p2, T3 p3, T4 p4) at Microsoft.Dynamics365.UIAutomation.Api.LoginDialog.Login(Uri uri, SecureString username, SecureString password)

The code being used... is as follows:

        var un = username.ToSecureString();
        var pw = password.ToSecureString();

        _configContext.BrowserOptions.Credentials = new BrowserCredentials(un, pw);
        _dynamicsContext.XrmBrowser = new Browser(_configContext.BrowserOptions);
        _dynamicsContext.UserName = username;

        _dynamicsContext.XrmBrowser.LoginPage.Login(_dynamicsContext.EnviromentUrl, un, pw);
SachchinAnnam commented 5 years ago

I faced similar issues initially and later i tried to create a local user and logged into the system using the local user. Later executed the scripts with that user and it worked any issues. Please try this approach.

jlattimer commented 5 years ago

@yoadster - were you able to resolve this?

vaclavrozsypal commented 5 years ago

Hi, I'm facing the same issue..

abhisekGupta07 commented 3 years ago

i'm still facing the issue.