Hi all,
I have been using public mguillem / JSErrorCollector for JS Error
validation. I have compared the Firebug console Js Error count with
JSErrorCollector count and observed that both are not matched.

Please find code for JSErrorCollector. I would like to know which is
showing correct value. Can any one help me please.


public class temp{
        static BufferedWriter bw;
        static WebDriver driver;

        static void writeline(String line){
                try{
                        bw.write(line);
                        bw.newLine();
                        bw.flush();
                        }catch(Exception ioe){ioe.printStackTrace();}}

        public static void main(String a[])throws Exception{
                 bw = new BufferedWriter(new FileWriter("out.txt",true));
                 //final String firebugPath = 
"d:\\selenium\\firebug-1.9.2-fx.xpi";
                 FirefoxDriver driver = new FirefoxDriver();
                        FirefoxProfile ffprofile = new
ProfilesIni().getProfile("default");//FirefoxProfile();
                        //ffprofile.addExtension(new File(firebugPath));
                        
//ffprofile.setPreference("extensions.firebug.currentversion",
"1.9.2");
                JavaScriptError.addExtension(ffprofile);
                        driver = new FirefoxDriver(ffprofile);

                 FileReader fr = new FileReader(new File("url.txt"));
                 BufferedReader reader = new BufferedReader(fr);
                 String line="";
                 writeline("-------------------------------");
                 while((line=reader.readLine())!=null){
                 try{
                         driver.get(line); 
//http://origin-www4.hasbro.com/littlestpetshop/
en_US/
                         //Thread.sleep(10000);
                         List<JavaScriptError> jsErrors =
JavaScriptError.readErrors(driver);
                        // Thread.sleep(6000);
                        System.out.println("###start displaying errors");
                        for(int i = 0; i < jsErrors.size(); i++) {
                                writeline("Web URL Name= " +line);
                                writeline("Get Source Name= " +
jsErrors.get(i).getSourceName());
                                writeline("Get JavaScript Error Message=
"+jsErrors.get(i).getErrorMessage());
                                
System.out.println(jsErrors.get(i).getErrorMessage());
                                writeline(String.valueOf("Get LineNumber=
"+jsErrors.get(i).getLineNumber()));
                                writeline("                    ");
                                
System.out.println(jsErrors.get(i).getSourceName());

                        }
                 }catch(Exception e){e.printStackTrace();}
                //  driver.close();
              //  driver.quit();


                 }
                 bw.close();
                 }

}

-- 
You received this message because you are subscribed to the Google
Groups "Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
https://groups.google.com/forum/#!forum/firebug

Reply via email to