Selenium FF WebDriver运行时开启firebug的2种方式
作者:网络转载 发布时间:[ 2015/1/13 14:31:56 ] 推荐标签:Selenium webdriver 自动化测试工具
上一次我实测FF webdriver 加载firefoxhttp://www.cnblogs.com/tobecrazy/p/3997375.html
那么问题来了,既然能加载firebug能否在运行时候直接激活firebug
效果如下:

针对这个情况,我们有两种solutions
方法1:使用firebug的快捷键F12激活firebug
不过这需要使用Actions class 的sendKeys method,使用sendKeys方法别忘了添加perform() 方法 否则不执行的
|
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 版本
} 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);
//F12 is a short cut of active firebug
//do not forget perform
actions.sendKeys(Keys.F12).perform();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
|
本文内容不用于商业目的,如涉及知识产权问题,请权利人联系SPASVO小编(021-61079698-8054),我们将立即处理,马上删除。
相关推荐
两种自动化测试工具AutoRunner与Selenium的对比关于Selenium自动化测试框架的较佳设计模式关于Selenium自动化测试框架那些你不知道的事哪种场景下,需要维护Selenium自动化测试过程?如何对Selenium自动化测试框架进行维护?Selenium自动化测试框架在自动化测试中发挥哪些作用?如何使用自动化测试框架ATF执行Selenium脚本?自动化测试脚本怎么写?如何使用Selenium录制浏览器的脚本?Selenium自动化测试框架软件好用吗?Selenium自动化测试框架ATF是如何根据数据生成用例的?多功能Selenium自动化测试框架软件ATFJava版本的Selenium异常记录第一个UI脚本-Python+Selenium实例:用Selenium和用Webdriver构建出来的测试工程如何放慢Selenium的运行速度Selenium借助AutoIt识别上传(下载)详解

sales@spasvo.com