microsoft / EasyRepro

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

Taking System credentials automatically during Login to CRM in IE (Private browser) #155

Open amars4u opened 6 years ago

amars4u commented 6 years ago

How to disable SSO. Even in IE Private window CRM is not asking for User Name and Password and directly takes the system credentials because of this we are unable to login to CRM with given credentials in app.config. We are able to login using CRM User credential in IE Private window if we do it manually only facing this issue when doing the same with selenium Automation.

MDendura commented 6 years ago

I'm facing this issue too in Chrome. I've tried these BrowserOptions and it still automatically logs in as the user running the browser process, rather than the ones in Credentials:

private static readonly BrowserOptions BrowserOptions = new BrowserOptions
{
    BrowserType = BrowserType.Chrome,
    FireEvents = true,
    Headless = false,
    UserAgent = false,
    CleanSession = true,
    Credentials = new BrowserCredentials(BrowserDriverUserName, BrowserDriverPassword),
    PrivateMode = true,
    StartMaximized = true
};

I hoped that a combination of CleanSession, Credentials and PrivateMode would do it, but no luck.

TYLEROL commented 6 years ago

Thank you @amars4u and @MDendura for providing feedback on this issue.

This is similar in nature to Issue #152 and we've observed it internally. I am not immediately aware of a fix outside of utilizing a non-domain computer accounts in the IE scenario.

I'll add an item to the backlog to review this scenario and see if we can determine both why this behavior is occurring and if we can implement a proper solution. In the past this had not been an issue with IE, but something in the last few months has changed behavior.

I'll update again once we have more information to share and/or if a fix has been identified.

Best Regards, Tyler

TYLEROL commented 6 years ago

@MDendura - Could you provide some details about which code branch and Dynamics org you are testing in addition to Chrome browser version and which Selenium WebDriver, Support driver, and Chrome driver you are using?

Thanks Tyler

markleavesley commented 6 years ago

As far as I could figure out, IE will use domain credentials against certain/all MS sites and there is nothing you can do to stop it. I don't know if Edge also suffers from this. My work around involved modifying the login source to sign out and sign back in with whatever credentials you want, and handle other minor differences in the login process.

I would be very wary of copying my changes (on the referenced ticket) as I "hacked" it to work for me in my scenario, it is not intended to be a general purpose fix.

MDendura commented 6 years ago

I've just done a quick manual test using InPrivate mode in Edge and I can log in with a different account as I'm prompted by both login.microsoftonline.com and my company's ADFS server 👍

An InPrivate session in IE11 behaves the same way as Chrome - I can enter my test account credentials for login.microsoftonline.com but the redirect to ADFS means that the user running the IE process is the one that gets logged in 👎

@markleavesley Signing out and then signing back in with IE results in the same undesirable behaviour, but thanks for the suggestion. It's the ADFS step that's causing me problems, I think.

MDendura commented 6 years ago

@TYLEROL Here's the extra details you asked for:

MDendura commented 5 years ago

@TYLEROL Is there any news about this issue?

TYLEROL commented 5 years ago

Hey @MDendura - We have not had any success in identifying the root cause driving this behavior.

I tested again today, and the problem for me is now only affecting Internet Explorer 11 InPrivate Mode. I've listed each of my browsers below if you're able to do a comparison:

- Working

- Not working

I'll reach out to members of our Internet Explorer team and see if I can get a more concrete determination as to why this issue may be occurring. It's not specific to EasyRepro, as I can replicate the problem launching InPrivate as a normal user.

The only workaround that we have right now is using non-domain user accounts / machines off the corporate network. Understandably these are not ideal.

Thanks, Tyler

lheng18 commented 5 years ago

I have an opposite scenario. I want to reuse the cached profile to open chrome browser or reuse existing on e to not have to get authenticated which would additional windows pop ups that Selenium can't handle . Details is in https://github.com/microsoft/EasyRepro/issues/510#issue-448195713. The test sample always opens a new browser in private/incognito and auto enter the username and password defined in app.config thus it fails to handle a windows popup requiring enter Smard card . How can we not let it open a private window and use my cached chrome profile stored in Appdata\Local\Chrome?

prdpmv commented 4 years ago

Any solution for this? We are getting this issue in chrome and unable to use test user for testing automation. We have SSO enabled through OKTA for office 365 apps.

rswafford commented 4 years ago

Any updates on this? I am testing it in Chrome, with Azure AD SSO and I get through the "Taking you to your organization's sign in page..." redirect, it goes to a blank screen and then pops a native browser dialog for credentials. At that point, the test bombs. If I put in creds, it passes through and authenticates correctly. Seems like I should be able to code around that?

mounahn commented 4 years ago

I'm getting similar issue on chrome version 80.0.3987.100. I have to login to Azure using test credentials, but selenium is using default user credentials to auto login in chrome.

If there were any solutions to this issue, could anyone share it

dongoloid commented 1 year ago

Im getting similar issues for the past few months at the moment. Hoping to hear back from the team as well.