2024-10-03 00:30:20 发布
网友
有人知道如何使用硒铬驱动程序将chrome.privacy.network.webRTCIPHandlingPolicy的值设置为disable_non_proxied_udp吗
chrome.privacy.network.webRTCIPHandlingPolicy
disable_non_proxied_udp
我不确定这是通过set_experimental_options还是set_desired_capabilities完成的
set_experimental_options
set_desired_capabilities
根据讨论disable_non_proxied_udp allows non-proxied TURN启用“防止WebRTC泄漏本地IP地址”将chrome.privacy.network.webRTCIPHandlingPolicy设置为disable_non_proxied_udp
参数 force-webrtc-ip-handling-policy覆盖WebRTC IP处理策略,以模拟在首选项中指定WebRTC IP处理策略时的行为
force-webrtc-ip-handling-policy
因此,作为首选项,您需要将enforce-webrtc-ip-permission-check设置为True
enforce-webrtc-ip-permission-check
True
因此,有效代码块:
Python:
from selenium import webdriver options = webdriver.ChromeOptions() options.add_experimental_option("prefs", { \ "enforce-webrtc-ip-permission-check": True }) options.add_argument("force-webrtc-ip-handling-policy") driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe') driver.get("https://www.google.com/")
Java:
HashMap<String, Object> prefs = new HashMap<>(); prefs.put("enforce-webrtc-ip-permission-check", true); ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("prefs", prefs); options.addArguments("force-webrtc-ip-handling-policy"); WebDriver driver = new ChromeDriver(options); driver.get("https://www.google.com/");
preferences = {"webrtc.ip_handling_policy": "disable_non_proxied_udp", "webrtc.multiple_routes_enabled": False, "webrtc.nonproxied_udp_enabled": False, "profile.managed_default_content_settings.images": 2} option.add_experimental_option("prefs", preferences)
根据讨论disable_non_proxied_udp allows non-proxied TURN启用“防止WebRTC泄漏本地IP地址”将
chrome.privacy.network.webRTCIPHandlingPolicy
设置为disable_non_proxied_udp
参数
force-webrtc-ip-handling-policy
覆盖WebRTC IP处理策略,以模拟在首选项中指定WebRTC IP处理策略时的行为因此,作为首选项,您需要将
enforce-webrtc-ip-permission-check
设置为True
因此,有效代码块:
Python:
Java:
相关问题 更多 >
编程相关推荐