如何在Java中处理Selenium中的代理?
import java.io.IOException;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class ProxySelJav {
public static void main(String[] args) {
//TODO自动生成的方法存根
WebDriver driver;
String prox = "localhost:8080";
// 设置具有所需功能的浏览器设置
Proxy p = new Proxy();
p.setHttpProxy(prox).setFtpProxy(prox).setSslProxy(prox)
.setSocksProxy(prox);
DesiredCapabilities c = new DesiredCapabilities();
c.setCapability(CapabilityType.PROXY, p);
//利用启动浏览器驱动程序的功能
driver = new Firefox(c);
}
}热门推荐
10 圣诞祝福语简短小学
11 祖国七十华诞简短祝福语
12 老师送的祝福语简短
13 生日祝福语大全女生简短
14 祝女性生日祝福语简短
15 牛年女神节祝福语简短
16 情人表白祝福语简短大气
17 老公开业祝福语简短
18 官宣新年祝福语简短