microsoft / EasyRepro

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

[HOW-TO] <Open Chrome Profile> #1349

Closed RicardoJacobsen closed 1 year ago

RicardoJacobsen commented 1 year ago

Question

How to set up easyrepro to open an specific chrome profile?

I came across this DownloadsPath in BrowserOptions, that is actualy options.AddUserProfilePreference("download.default_directory", DownloadsPath);

I set the DownloadsPath = "My profile". However, this is still opening a standard Profile 1 in chrome.

What should I do in this case?

Shakevg commented 1 year ago

RicardoJacobsen It is not supported for now https://github.com/microsoft/EasyRepro/blob/46dbe57e5e07254b960baa05bcf5ac45d76cbd10/Microsoft.Dynamics365.UIAutomation.Browser/BrowserOptions.cs But you can add this feature: it is should be something like here

RicardoJacobsen commented 1 year ago

I found a solution for it.

In Microsoft.Dynamics365.UIAutomation.Browser >> BrowserOptions.cs I added: this.UseProfile = true;

like image below image

Scrolling a little bit in the same BrowserOptions.cs

I inserted the the following code: public bool UseProfile { get; set; }

Like image below image

To finalize, scrolling a little bit more, I inserted the following code:

        if (this.UseProfile)
        {
            options.BinaryLocation = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
            options.AddArgument("--user-data-dir=C:\\Users\\RicardoJacobsen\\AppData\\Local\\Google\\Chrome\\User Data");
            options.AddArgument("--profile-directory=Profile 6");
            options.AddArgument("--remote-debugging-port=9222");
        }

As image below: image

To get the correct profile that I wanted I clicked with the right button on the Chrome profile and went to properties.

As img below: image

It's good to mention that after configuring all this, insanely I had to restart the computer to this changes work. hahahaha

Shakevg commented 1 year ago

RicardoJacobsen It will be a good idea to push your solution to git with the profile name as a parameter.

RicardoJacobsen commented 1 year ago

Hello Shakevg. Thanks for reaching out.

No worries, will do that.

Any other suggestions please let me know.

Kind regards Ricardo Jacobsen

Sent on the go with Vodafone Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Shakevg @.> Sent: Friday, January 20, 2023 12:27:29 AM To: microsoft/EasyRepro @.> Cc: Ricardo Jacobsen @.>; State change @.> Subject: Re: [microsoft/EasyRepro] [HOW-TO] (Issue #1349)

RicardoJacobsenhttps://github.com/RicardoJacobsen It will be a good idea to push your solution to git with the profile name as a parameter.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/EasyRepro/issues/1349#issuecomment-1397254163, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATCHY6Z6GRQD5RPTLQV2JRDWTFTPDANCNFSM6AAAAAASWIJOHI. You are receiving this because you modified the open/close state.Message ID: @.***>

AngelRodriguez8008 commented 11 months ago

It doesn't work for me.