Bij*_*hal 6 selenium-webdriver
我不想为我的办公室网络提供代理设置的用户名/密码,我可以将PROXY提供给浏览器:
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);
Run Code Online (Sandbox Code Playgroud)
要么
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);
Run Code Online (Sandbox Code Playgroud)
但是,无论我做什么,它仍然要求Webdriver的密码.注意:我可以发送htmlunit驱动程序的用户名/密码.请帮忙!
尝试下面
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 0);
WebDriver driver = new FirefoxDriver(profile);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1883 次 |
| 最近记录: |