如何在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 教师闺蜜祝福语简短