
FirefoxProfile profile = new FirefoxProfile()
//使用profile
ProfilesIni allProfiles = new ProfilesIni()
FirefoxProfile profile = allProfiles.getProfile("default")
driver = new FirefoxDriver(profile)
// 使用代理
profile.setPreference(“network.proxy.type”, 1)
// http协议代理配置
profile.setPreference(“network.proxy.http”, proxyIp)
profile.setPreference(“network.proxy.http_port”, proxyPort)
// 所有协议公用一种代理配置,如果单独配置,这项设置为false,再类似于http的配置
profile.setPreference(“network.proxy.share_proxy_settings”, true)
// 对于localhost的不用代理,这里必须要配置,否则无法和webdriver通讯
profile.setPreference(“network.proxy.no_proxies_on”, “localhost”)
// 以代理方式启动firefox
FirefoxDriver ff = new FirefoxDriver(profile)
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)