gpt4 book ai didi

Java Selenium FirefoxDriver 忽略给定的代理设置

转载 作者:行者123 更新时间:2023-12-01 17:10:23 25 4
gpt4 key购买 nike

我期望浏览器显示代理值,但它显示了我的实际 IP。知道为什么吗?

'''

FirefoxOptions options = new FirefoxOptions();
options.addPreference("network.proxy.type", 1);
options.addPreference("network.proxy.https", "151.253.165.70");
options.addPreference("network.proxy.https_port", 8080);
options.addPreference("network.proxy.https_remote_dns", true);
WebDriver driver = new FirefoxDriver(options);
driver.get("https://www.whatismyip.com");

'''

最佳答案

您可以使用 firefoxprofile 或选项。为 Https 使用的代理添加 SSL。 options.addPreference("network.proxy.ssl", "151.253.165.70"); options.addPreference("network.proxy.ssl_port", 8080);

FirefoxOptions options = new FirefoxOptions();
options.addPreference("network.proxy.type", 1);
options.addPreference("network.proxy.https", "151.253.165.70");
options.addPreference("network.proxy.https_port", 8080);
options.addPreference("network.proxy.https_remote_dns", true);

options.addPreference("network.proxy.ssl", "151.253.165.70");
options.addPreference("network.proxy.ssl_port", 8080);

WebDriver driver = new FirefoxDriver(options);
driver.get("https://www.whatismyip.com");

如果您正在使用个人资料

    profile.setPreference("network.proxy.type", 1);
profile.setPreference("network.proxy.http", "151.253.165.70");
profile.setPreference("network.proxy.http_port", 8080);
profile.setPreference("network.proxy.https", "151.253.165.70");
profile.setPreference("network.proxy.https_port", 8080);
profile.setPreference("network.proxy.ssl", "151.253.165.70");
profile.setPreference("network.proxy.ssl_port", 8080);
profile.setPreference("network.proxy.https_remote_dns", true);

关于Java Selenium FirefoxDriver 忽略给定的代理设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61432210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com