Selenium Webdriver + Java - 如何为 firefox 配置自动代理配置 URL?
Selenium Webdriver + Java - How to configure automatic proxy configuration URL for firefox?
我正在尝试配置我的 FirefoxDriver 以使用自动代理配置 URL。我没有这样做。
我的代码如下所示:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 2);
profile.setPreference("network.proxy.autoconfig_url", "http://10.203.193.52/Proxy-cmv.pac");
WebDriver driver = new FirefoxDriver();
我没有收到任何类型的错误,但此浏览器无法连接。从 Firefox 菜单中检查选项 > 高级 > 网络 > 连接设置时,代理设置为 "Use system proxy"。
您需要使用该配置文件,因为现在您只需创建它。
所以,改变:
WebDriver driver = new FirefoxDriver();
到
WebDriver driver = new FirefoxDriver(profile);
我正在尝试配置我的 FirefoxDriver 以使用自动代理配置 URL。我没有这样做。
我的代码如下所示:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 2);
profile.setPreference("network.proxy.autoconfig_url", "http://10.203.193.52/Proxy-cmv.pac");
WebDriver driver = new FirefoxDriver();
我没有收到任何类型的错误,但此浏览器无法连接。从 Firefox 菜单中检查选项 > 高级 > 网络 > 连接设置时,代理设置为 "Use system proxy"。
您需要使用该配置文件,因为现在您只需创建它。
所以,改变:
WebDriver driver = new FirefoxDriver();
到
WebDriver driver = new FirefoxDriver(profile);