如何在Selenium测试中禁用“个性化您的网络体验”MS Edge提示?

huangapple go评论141阅读模式
英文:

How can I disable 'Personalize your web experience' MS Edge prompt for Selenium tests

问题

从MS Edge版本113.0.1774.50开始,我的Selenium测试(使用C#编写)开始失败,因为出现了“个性化您的Web体验”提示。
‘个性化您的Web体验’提示
如果测试使用新的用户配置文件,则会复制此问题。此对话框可能会随机出现,但更常见的是,当我导航到包含我的应用程序并尝试登录时,它会出现。
注意:在MS Edge 113.0.1774.42及更早版本上未复制此问题,而在MS Edge Beta 114上也未复制此问题。

我想关闭此对话框。尝试使用PowerShell脚本通过注册表关闭不同的Edge策略:
1)禁用PersonalizationReportingEnabled策略 - 按照文章中的说明执行了一切,设置为禁用,但对话框仍然出现;
2)禁用DefaultBrowserSettingsCampaignEnabled策略 - 在MS Edge 113中添加了它,因此我认为可能与此相关。
3)禁用以下策略(分别):HideFirstRunExperience,SoftLandingEnabled,SubscribedContent-310093Enabled,ShowRecommendationsEnabled
4)尝试禁用在MS Edge 113中添加的属性(一起)。取自此文章 - https://learn.microsoft.com/en-us/deployedge/microsoft-edge-policies:DiscoverPageContextEnabled,EnforceLocalAnchorConstraintsEnabled,EnhanceSecurityMode,ReadAloudEnabled,RestorePdfView,TabServicesEnabled

英文:

Starting with MS Edge version 113.0.1774.50 my Selenium tests (written on c#) started to fail, because of appearing 'Personalize your web experience' prompt.
'Personalize your web experience' prompt
The issue is reproduced if tests use new user profile. This dialog can appear randomly, but more often, when I am navigating to the link with my application and trying to login into it.
Note: the issue was not reproduced on MS Edge 113.0.1774.42 and earlier, and it's not reproduced on MS Edge Beta 114.

I want to turn off this dialog. Tried to turn of different Edge policies via register using PowerShell scripts

  1. disable PersonalizationReportingEnabled policy - did everything according to the article, setting is disabled, but dialog is still appearing;
  2. disable DefaultBrowserSettingsCampaignEnabled policy - it was added in MS Edge 113, so I thought, that it can be related.
  3. disable following policies (separately): HideFirstRunExperience, SoftLandingEnabled, SubscribedContent-310093Enabled, ShowRecommendationsEnabled
  4. tried to disable properties, which were added in MS Edge 113 (all together).Taken form this article - https://learn.microsoft.com/en-us/deployedge/microsoft-edge-policies: DiscoverPageContextEnabled, EnforceLocalAnchorConstraintsEnabled, EnhanceSecurityMode, ReadAloudEnabled, RestorePdfView, TabServicesEnabled

答案1

得分: 3

以下是您要翻译的内容:

看起来我已经找到了解决问题的方法:

发现,如果打开“个性化和广告”选项(打开MS Edge,转到“设置” -> “隐私、搜索和服务” -> “个性化和广告”部分),则不会显示“个性化您的网络体验”提示。
如何在Selenium测试中禁用“个性化您的网络体验”MS Edge提示?

如果您需要在Selenium测试中通过代码执行此操作,请执行以下操作:

var options = new EdgeChromiumOptions();
options.AddUserProfilePreference("user_experience_metrics", new
{
    personalization_data_consent_enabled = true
});

另一个选项是转到“Edge配置文件”文件夹 -> “Default” -> “Preferences”并手动将此选项设置为true。
如何在Selenium测试中禁用“个性化您的网络体验”MS Edge提示?

英文:

It seems that I've found solution for the problem:

It was found, that 'Personalize your web experience' prompt is not displayed, if 'Personalization & advertising' option is turned ON (open MS Edge, go to the 'Settings' -> 'Privacy, search, and services' -> 'Personalization & advertising' section and turn on this option)
如何在Selenium测试中禁用“个性化您的网络体验”MS Edge提示?

If you need to do it for Selenium tests via code, do the following:

  var options = new EdgeChromiumOptions();
  options.AddUserProfilePreference("user_experience_metrics", new
  {
     personalization_data_consent_enabled = true
  });

Another options is go to the 'Edge Profile' folder -> 'Default' -> 'Preferences' and set this option manually to true
如何在Selenium测试中禁用“个性化您的网络体验”MS Edge提示?

答案2

得分: 3

你可以在"Guest Mode"下运行Edge,以避免出现"个性化您的网络体验"的提示。

以下是如何为Python用户设置该选项的方法:

options.add_argument("--guest")
英文:

You can run Edge in Guest Mode to avoid the Personalize your web experience prompt.

Here's how to set that option for Python users:

options.add_argument("--guest")

答案3

得分: 0

你尝试过在隐私模式下运行浏览器吗?为了实现这一点,你可以将这个选项添加为参数。

private static readonly ThreadLocal<IWebDriver> driver = new();
edgeOptions.AddArgument("-inprivate");

new WebDriverManager.DriverManager().SetUpDriver(new EdgeConfig());
driver.Value = new EdgeDriver(edgeOptions);
英文:

Have you tried run the browser in Inprivate mode? In order to achieve this you can add this option as argument.

private static readonly ThreadLocal<IWebDriver> driver = new();
edgeOptions.AddArgument("-inprivate");

new WebDriverManager.DriverManager().SetUpDriver(new EdgeConfig());
driver.Value = new EdgeDriver(edgeOptions);

答案4

得分: 0

我已成功复制了这个问题,但恐怕目前没有相应的组策略来控制这种行为。如果您希望在将来的版本中引入这样的组策略,您可以通过在浏览器中按下Alt+Shift+I来提交反馈。

作为一种解决方法,您可能需要为自动化测试指定一个配置文件以避免出现此提示。

然而,这里有一个我发现的有趣行为。希望对您有所帮助:如果当前页面被刷新或重定向,提示将不再存在。

英文:

I have successfully replicated this issue, but I'm afraid that currently there's no such group policy to control this behavior. If you would like to see such a group policy introduced in the future releases, you can submit feedback by pressing Alt+Shift+I in the browser.

As a workaround, you may need to specify a profile for automation test to avoid this prompt.

However, here's an interesting behavior I've found. I hope it will be helpful to you: if the current page is refreshed or redirected, the prompt will no longer exist.

答案5

得分: 0

需要禁用这两个设置。我刚从微软那里得到了这些信息,对我有效。

组策略(ADMX)信息
GP唯一名称:ShowRecommendationsEnabled
GP名称:允许从Microsoft Edge接收推荐和促销通知
或GP名称:允许从Microsoft Edge接收功能推荐和浏览器协助通知
GP路径(强制性):管理模板/Microsoft Edge/
GP路径(推荐):N/A
GP ADMX文件名:MSEdge.admx

Windows注册表设置
路径(强制性):SOFTWARE\Policies\Microsoft\Edge
路径(推荐):N/A
数值名称:ShowRecommendationsEnabled
数值类型:REG_DWORD

组策略(ADMX)信息
GP唯一名称:PersonalizationReportingEnabled
GP名称:允许通过将浏览历史、收藏夹和收藏夹、使用情况和其他浏览数据发送到Microsoft来个性化广告、Microsoft Edge、搜索、新闻和其他Microsoft服务
GP路径(强制性):管理模板/Microsoft Edge/
GP路径(推荐):N/A
GP ADMX文件名:MSEdge.admx

Windows注册表设置
路径(强制性):SOFTWARE\Policies\Microsoft\Edge
路径(推荐):N/A
数值名称:PersonalizationReportingEnabled
数值类型:REG_DWORD

英文:

You will need disable both of these settings. I just got this info from MS and it is working for me.

Group Policy (ADMX) info
GP unique name: ShowRecommendationsEnabled
GP name: Allow recommendations and promotional notifications from Microsoft Edge
or GP name: Allow feature recommendations and browser assistance notifications from Microsoft Edge
GP path (Mandatory): Administrative Templates/Microsoft Edge/
GP path (Recommended): N/A
GP ADMX file name: MSEdge.admx

Windows Registry Settings
Path (Mandatory): SOFTWARE\Policies\Microsoft\Edge
Path (Recommended): N/A
Value Name: ShowRecommendationsEnabled
Value Type: REG_DWORD

And

Group Policy (ADMX) info
GP unique name: PersonalizationReportingEnabled
GP name: Allow personalization of ads, Microsoft Edge, search, news and other Microsoft services by sending browsing history, favorites and collections, usage and other browsing data to Microsoft
GP path (Mandatory): Administrative Templates/Microsoft Edge/
GP path (Recommended): N/A
GP ADMX file name: MSEdge.admx

Windows Registry Settings
Path (Mandatory): SOFTWARE\Policies\Microsoft\Edge
Path (Recommended): N/A
Value Name: PersonalizationReportingEnabled
Value Type: REG_DWORD

huangapple
  • 本文由 发表于 2023年6月1日 05:17:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76377363.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定