MicrosoftEdge / EdgeWebDriver

Feedback and discussions about WebDriver for Microsoft Edge
MIT License
56 stars 7 forks source link

Cannot disable SwitchIntranetSitesToWorkProfile by command line #131

Open rmangin opened 9 months ago

rmangin commented 9 months ago

Hello Microsoft,

When precising a dedicated "Profile 1" to edge driver together with --disable-features=SwitchIntranetSitesToWorkProfile, opening an intranet URL will switch to "Work" Profile.

Only option found is to disable the feature manually when it occurs site by site (Do not switch) - notification is a nice feature, disabled by default (disabling the toggle button for the general feature does not have an effect), really bad for an automated test tool right?

Can we disable such switch feature by command line? It's really important we get rid of profile redirection when edgedriver is told to open a specific session. For now, we will document to customer that this is a Microsoft setting we are not able to handle by command lines with a dedicated public Knowledge Based Article listing problems with Edge (like clicking on a File Upload if "you're not a human"

More generally, we struggle a LOT with edge driver to find official Microsoft documentation about list of supported features & parameters that can be specified in the --enable-features or --disable-features. Most of the time, you can find policies but no useful list of parameters that actually work.

edge://version : Microsoft Edge | 120.0.2210.61 (Official build) (64-bit)

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --allow-pre-commit-input --allow-running-insecure-content --disable-background-networking --disable-backgrounding-occluded-windows --disable-client-side-phishing-detection --disable-default-apps --disable-features=SwitchIntranetSitesToWorkProfile,StrictOriginIsolation,IsolateOrigins,site-per-process,CrossSiteDocumentBlockingIfIsolating,CrossSiteDocumentBlockingAlways --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-site-isolation-trials --disable-sync --enable-automation --enable-features=msEdgeDeleteBrowsingDataOnExit --enable-logging --ignore-certificate-errors --log-level=0 --no-first-run --no-service-autorun --no-session-restore --password-store=basic --profile-directory="Profile 1" --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\me\AppData\Local\Microsoft\Edge\User Data" --flag-switches-begin --flag-switches-end

Profile path C:\Users\me\AppData\Local\Microsoft\Edge\User Data\Profile 1

Best Regards, Rémi from SAP Support.

AB#48193617

jbakeri4 commented 9 months ago

I'd use the Guest Profile to avoid this issue, unless this Profile 1 you've created has some other configurations you need that weren't mentioned in your original post.

In Selenium [I'm using Java] I instantiate EdgeOptions then pass the --guest argument like so: options.addArguments("--guest");

If launching Edge from the CLI you should be able to pass it via --guest like you're passing your other arguments; "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --guest.

Finally, since Edge is based on Chromium most -not all- switches from Chrome will work with Edge. This is considered the most comprehensive list of known switches.

rmangin commented 9 months ago

Hi jbarkeri4,

Thanks for your hint and your quick reaction, it works but cannot be retained as a valid solution since the extensions are disabled in the guest session. Unfortunately, we do have to work with our extension whatever the dedicated profile is (Profile 1 was just a side-test).

Indeed, the guest session is able to keep navigation in its own profile while any other profile will be switching automatically to the Work profile unless the end user, site by site, is actively choosing the "Don't Switch" option. The problem I have is that there is no way to remove this feature (neither by command line nor by Profile 1 settings - not respected at runtime). This does not work unless each site is marked as Don't Switch. A nightmare since there's no final user on the Virtual Machine where the Automated Test Tool is deployed.

The current solution I imagine for our customers is to take a trainee to check each VM each morning to click on "Don't Switch" and pray the next day it's okay (for each customer). They wouldn't appreciate the manual effort to make the automation working.

In my opinion it's buggee. Since I never heard about a profile switch nor a "Work" profile in Chrome, I suppose this is additional layer from Microsoft and should be reported as a bug since the preferences are not working nor taken into account by command line (if at least one option was working I wouldn't opened this issue).

Is SwitchIntranetSitesToWorkProfile something in chromium really or added by Microsoft on top?

Would it be possible to report their bugs to MS Edge directly? Internally at SAP, we don't have a channel to report issues in Edge versions, our partnership is more Microsoft to SAP than bidirectional. I thought I was at the right place to report.

Additionally, I have posted this feedback to make MS aware this issue here exists.

Best Regards, Rémi from SAP Support.

jbakeri4 commented 9 months ago

@rmangin Ah, I see. Wasn't aware your requirements included an extension to be loaded in/with Profile 1. Unfortunately, as you've found Edge does not support extensions in its Guest Profile sessions.

Your manual workaround introduces a failure point -as I'm sure you are aware- because GPO rules perodically refresh on domain-joined machines. But if you have the ability to execute elevated commands on these VMs, you might consider the below Registry edit command [should work in both Command Prompt and PowerShell]: reg add HKLM\SOFTWARE\Policies\Microsoft\Edge /v SwitchIntranetSitesToWorkProfile /t REG_DWORD /d 0x00000000 See if your Don't Switch option selection persists after a 24-hour period. It should 🤞🏻

To answer your question regarding SwitchIntranetSitesToWorkProfile that is indeed a Microsoft Edge-specific flag.

I have never had to report Edge-related issues to Microsoft outside of EdgeDriver, so I am not sure of any other channels outside of this GitHub repo Issue page we're currently on, I apologise. But as an aside, you might consider appending a summary of the issue you reported on this tracker to the one you submitted on the Edge-Developer repo Issue tracker. I can't speak for Microsoft but most forum users appreciate embedded info rather than links, which can break/be removed at any time.

Cheers.

bwalderman commented 9 months ago

Thanks for reporting this. I've added this to our internal backlog for investigation.