如何通过Selenium WebDriver关闭Firefox浏览器的"增强跟踪保护"?



我的Selenium Java测试脚本在Firefox浏览器上运行。

最近,它开始在打开"增强跟踪保护"的应用程序上失败

https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-desktop

如何通过Selenium Web驱动程序禁用/关闭它?有什么偏好或功能可以让我在Firefox配置文件中关闭它吗?

我在PowerShell中使用Selenium,遇到了同样的问题。这个解决方案适用于我

[OpenQA.Selenium.Firefox.FirefoxProfileManager]$ProfileManager= [OpenQA.Selenium.Firefox.FirefoxProfileManager]::new()
[OpenQA.Selenium.Firefox.FirefoxProfile]$FirefoxProfile = $ProfileManager.GetProfile($ProfileName)
$FirefoxProfile.SetPreference("pref.privacy.disable_button.tracking_protection_exceptions", $true)

最新更新