作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我不想为我的办公网络的代理设置提供用户名/密码,我可以将代理提供给浏览器:
String PROXY = "localhost:8080";
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY)
.setFtpProxy(PROXY)
.setSslProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabailities();
cap.setPreference(CapabilityType.PROXY, proxy);
user_pref("network.proxy.http", "127.0.0.1");
user_pref("network.proxy.http_port", 8084);
user_pref("network.proxy.ssl", "127.0.0.1");
user_pref("network.proxy.ssl_port", 8084);
user_pref("network.proxy.no_proxies_on", "localhost:4444");
user_pref("network.proxy.type", 1);
最佳答案
试试下面
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 0);
WebDriver driver = new FirefoxDriver(profile);
关于selenium-webdriver - 如何为代理包含代理身份验证用户名和密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8840715/
我是一名优秀的程序员,十分优秀!