Selenium FF WebDriver运行时开启firebug的2种方式
作者:网络转载 发布时间:[ 2015/1/13 14:31:56 ] 推荐标签:Selenium webdriver 自动化测试工具
另外一种方法是直接使用Firefox的setPreference
我们注意到:FF 的extensions.firebug.allPagesActivation设置为ON,firebug会被active
File file=new File("C:\webdriver\firebug-2.0.4-fx.xpi");//设置Firebug路径
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 2);
profile.setPreference("network.proxy.autoconfig_url","http://proxy.successfactors.com:8083"); //自动代理配置
try {
//add firebug
profile.addExtension(file);
profile.setPreference("extensions.firebug.currentVersion", "2.0.4");//设置firebug 版本
//active firebug extensions
profile.setPreference("extensions.firebug.allPagesActivation", "on");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
WebDriver driver = new FirefoxDriver(profile);
driver.get("http://www.dbyl.cn");
Actions actions=new Actions(driver);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);