如何在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);
}
}热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短