Firebug - JS Error validation report is not match with JsError Collector report

118 views
Skip to first unread message

Krishnamoorthy Cognizant

unread,
May 22, 2012, 3:00:56 PM5/22/12
to Firebug, krishnam...@cognizant.com
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();
}

}

Jan Honza Odvarko

unread,
May 23, 2012, 2:51:23 AM5/23/12
to Firebug
The way how JSErrorCollector collects errors is slightly different,
but when I load www.google.com
I see two (the same) errors produced by Firebug and JSErrorCollector

What page should I load to see a difference?

Honza

On May 22, 9:00 pm, Krishnamoorthy Cognizant

Krishnamoorthy Cognizant

unread,
May 26, 2012, 11:29:24 AM5/26/12
to Firebug
Thanks for the updates. I have provided theURL in the above code
itself.
FYIP;
driver.get(line); //http://origin-www4.hasbro.com/littlestpetshop/
en_US/

Many of the errors are not identified by JS error collector when
comparing with Firebug. Please share your thoughts.

Thanks
Krish
> > }- Hide quoted text -
>
> - Show quoted text -

Jan Honza Odvarko

unread,
May 28, 2012, 11:26:27 AM5/28/12
to Firebug
Hm... I don't see any errors when loading:
http://origin-www4.hasbro.com/littlestpetshop/

(nor Firebug neither ErrorCollector)

Honza

On May 26, 5:29 pm, Krishnamoorthy Cognizant
Reply all
Reply to author
Forward
0 new messages