Weberiver 运行时开启Firebug

1.打开Firefox浏览器.在浏览器地址栏输入about:config

在Search栏中输入: firebug.allPagesActivation

2.设置extentsion.firebug.allPagesActivation的Value值为on

3.在程序中设置:

 

//设置Firebug路径

File file=new File("C:\\webdriver\\firebug-2.0.17.xpi");
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);

                //设置firebug 版本

                profile.setPreference("extensions.firebug.currentVersion", "2.0.17");
                //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.baidu.com");
            Actions actions=new Actions(driver);
           
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
            driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);

posted @ 2019-10-28 15:07  JakeYu  阅读(103)  评论(0)    收藏  举报