Configure firebug & netexport for automatic output from selenium

3,009 views
Skip to first unread message

Cy Bercom

unread,
Sep 19, 2011, 4:47:16 AM9/19/11
to Firebug
Hello,

I am not sure if this is the appropriate group for this question but I
am using Selenium and like to have automatic output from the Net tab
in firebug. I have installed net export and it works when I run FF
manually.

But when I try the same thing when running FF from Selenium I get
nada. I checked with about:config and set the firebug and netexport
preferences marked as user defined.

This is the C# code I am using:

try
{
textBox1.Text = "Starting Firefox.." +
Environment.NewLine;

//Add firebug & netxport

FirefoxProfile profile = new FirefoxProfile();
string firebugPath = "C:\\Mozilla plugins\
\firebug-1.8.2.xpi";
string netexportPath = "C:\\Mozilla plugins\
\netExport-0.8b17.xpi";
profile.AddExtension(firebugPath);
profile.AddExtension(netexportPath);


profile.SetPreference("extensions.firebug.currentVersion","1.8.2"); //
remove first run tab
//
profile.SetPreference("extensions.firebug.addonBarOpened", true);

profile.SetPreference("extensions.firebug.console.enableSites", true);
//
profile.SetPreference("extensions.firebug.allPagesActivation;on",
"on");

profile.SetPreference("extensions.firebug.previousPlacement",1);

profile.SetPreference("extensions.firebug.onByDefault",true);

profile.SetPreference("extensions.firebug.defaultPanelName","net");

profile.SetPreference("extensions.firebug.net.enableSites",true);
//
profile.SetPreference("extensions.firebug.script.enableSites", true);
string output_dir =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
output_dir = Path.Combine(output_dir,"Firebug
netexports");
if (!Directory.Exists(output_dir))
{
Directory.CreateDirectory(output_dir);
}

profile.SetPreference("extensions.firebug.netexport.defaultLogDir",output_dir);

profile.SetPreference("extensions.firebug.netexport.alwaysEnableAutoExport",true);

profile.SetPreference("extensions.firebug.netexport.showPreview",
true); // preview

profile.SetPreference("extensions.firebug.netexport.sendToConfirmation",
false);

profile.SetPreference("extensions.firebug.netexport.pageLoadedTimeout",
3000);

profile.SetPreference("extensions.firebug.netexport.autoExportToFile",true);

profile.SetPreference("extensions.firebug.netexport.Automation",
true);

System.Threading.Thread.Sleep(5000); //allow firebug
to load
textBox1.AppendText("Added firebug extension and set
preferences" + Environment.NewLine);
textBox1.AppendText("Netexport output folder: " +
output_dir + Environment.NewLine);


IWebDriver driver = new
FirefoxDriver(profile);
//IWebDriver driver = new FirefoxDriver();
driver.Navigate().GoToUrl("http://www.dn.se");
System.Threading.Thread.Sleep(4000);
driver.FindElement(By.LinkText("Ekonomi")).Click();
System.Threading.Thread.Sleep(4000);


textBox1.AppendText("Färdigt");
driver.Quit();
}
catch (Exception exc)
{
textBox1.Text = exc.ToString();
}


Is there anyone that have this working? I am using the latest 6.x
version of FF.

/Cy

Jan Honza Odvarko

unread,
Sep 20, 2011, 7:23:20 AM9/20/11
to Firebug
On Sep 19, 10:47 am, Cy Bercom <cybercom.d...@gmail.com> wrote:
> Hello,
>
> I am not sure if this is the appropriate group for this question but I
Yes it is

> am using Selenium and like to have automatic output from the Net tab
> in firebug. I have installed net export and it works when I run FF
> manually.
>
> But when I try the same thing when running FF from Selenium I get
> nada.
nada? Does it mean the result file is there but empty or it isn't
there at all?


> I checked with about:config and set the firebug and netexport
> preferences marked as user defined.
>
> This is the C# code I am using:
>
> try
>             {
>                 textBox1.Text = "Starting Firefox.." +
> Environment.NewLine;
>
>                 //Add firebug & netxport
>
>                 FirefoxProfile profile = new FirefoxProfile();
>                 string firebugPath = "C:\\Mozilla plugins\
> \firebug-1.8.2.xpi";
>                 string netexportPath = "C:\\Mozilla plugins\
> \netExport-0.8b17.xpi";
>                 profile.AddExtension(firebugPath);
>                 profile.AddExtension(netexportPath);
>
> profile.SetPreference("extensions.firebug.currentVersion","1.8.2"); //
> remove first run tab
Try to use bigger number e.g. 2.0 to avoid the 'firstrun' page being
opened.

>                 //
> profile.SetPreference("extensions.firebug.addonBarOpened", true);
I guess this could be false

>
> profile.SetPreference("extensions.firebug.console.enableSites", true);
>                 //
> profile.SetPreference("extensions.firebug.allPagesActivation;on",
> "on");
>
> profile.SetPreference("extensions.firebug.previousPlacement",1);
>
> profile.SetPreference("extensions.firebug.onByDefault",true);
>
> profile.SetPreference("extensions.firebug.defaultPanelName","net");
>
> profile.SetPreference("extensions.firebug.net.enableSites",true);
>                 //
> profile.SetPreference("extensions.firebug.script.enableSites", true);
>                 string output_dir =
> Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
>                 output_dir = Path.Combine(output_dir,"Firebug
> netexports");
>                 if (!Directory.Exists(output_dir))
>                 {
>                     Directory.CreateDirectory(output_dir);
>                 }
>
> profile.SetPreference("extensions.firebug.netexport.defaultLogDir",output_dir);
>
> profile.SetPreference("extensions.firebug.netexport.alwaysEnableAutoExport",true);
>
> profile.SetPreference("extensions.firebug.netexport.showPreview",
> true); // preview
I would set this to false to avoid opening an extra Firefox tab with
the preview.
What version of Firebug and NetExport?

Any Errors in FBTrace or Firefox Error console?


Honza

>
> /Cy

Cy Bercom

unread,
Sep 20, 2011, 2:33:08 PM9/20/11
to fir...@googlegroups.com
Hi Jan,

sorry for being too vague in my description.
The issue I have is that when I run FF manually with my settings a HAR file is automatically created in the log directory. It is named with the baseurl + timedate.

When I run my Selenium test I expect it to navigate according to my code - and it does - and I also expect to have at least one HAR file in the defined log directory - but there is no file. So the selenium test goes through but I have no HAR file.


2011/9/20 Jan Honza Odvarko <odv...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Firebug" group.
To post to this group, send email to fir...@googlegroups.com.
To unsubscribe from this group, send email to firebug+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/firebug?hl=en.


Jan Honza Odvarko

unread,
Sep 21, 2011, 3:00:26 AM9/21/11
to Firebug
This sounds like a bug. Please create a new report and I'll take a
look.
http://code.google.com/p/fbug/issues/list

Honza


On Sep 20, 8:33 pm, Cy Bercom <cybercom.d...@gmail.com> wrote:
> Hi Jan,
>
> sorry for being too vague in my description.
> The issue I have is that when I run FF manually with my settings a HAR file
> is automatically created in the log directory. It is named with the baseurl
> + timedate.
>
> When I run my Selenium test I expect it to navigate according to my code -
> and it does - and I also expect to have at least one HAR file in the defined
> log directory - but there is no file. So the selenium test goes through but
> I have no HAR file.
>
> 2011/9/20 Jan Honza Odvarko <odva...@gmail.com>

Jan Honza Odvarko

unread,
Oct 2, 2011, 3:34:24 AM10/2/11
to Firebug
Just tested NetExport & Selenium and it works for me.

Some notes:

1) The following pref (from your summary) is wrong:
profile.SetPreference("extensions.firebug.allPagesActivation;on",
"on");
it should be:
profile.SetPreference("extensions.firebug.allPagesActivation", "on");

2) I used setSleep(3) (PHPUnit, set the number of seconds the Selenium
RC client should sleep between sending action commands to the Selenium
RC server) so, NetExport has time to actually export something (before
Selenium closes the browser).

Here is my simple test in PHP:

class HAR_Test2 extends HAR_TestCase
{
protected function setUp()
{
$this->setBrowser("*firefox");
$this->setBrowserUrl("http://www.janodvarko.cz/har/viewer");
}

public function testTabs()
{
$this->setSleep(3);
$this->open("http://www.janodvarko.cz/har/viewer");
}
}

3) Here are prefs I changed:

extensions.firebug.netexport.alwaysEnableAutoExport; true
extensions.firebug.netexport.defaultLogDir; I:\www\har\selenium\logs
extensions.firebug.netexport.showPreview; false
extensions.firebug.allPagesActivation; on
extensions.firebug.net.enableSites; true

Honza

On Sep 21, 9:00 am, Jan Honza Odvarko <odva...@gmail.com> wrote:
> This sounds like a bug. Please create a new report and I'll take a
> look.http://code.google.com/p/fbug/issues/list
>
> Honza
>
> On Sep 20, 8:33 pm, Cy Bercom <cybercom.d...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi Jan,
>
> > sorry for being too vague in my description.
> > The issue I have is that when I run FF manually with my settings a HAR file
> > is automatically created in the log directory. It is named with the baseurl
> > + timedate.
>
> > When I run mySeleniumtest I expect it to navigate according to my code -
> > and it does - and I also expect to have at least one HAR file in the defined
> > log directory - but there is no file. So theseleniumtest goes through but
> > I have no HAR file.
>
> > 2011/9/20 Jan Honza Odvarko <odva...@gmail.com>
>
> > > On Sep 19, 10:47 am, Cy Bercom <cybercom.d...@gmail.com> wrote:
> > > > Hello,
>
> > > > I am not sure if this is the appropriate group for this question but I
> > > Yes it is
>
> > > > am usingSeleniumand like to have automatic output from the Net tab
> > > > in firebug. I have installed net export and it works when I run FF
> > > > manually.
>
> > > > But when I try the same thing when running FF fromSeleniumI get
> > > >                 textBox1.AppendText("Netexportoutput folder: " +

Cy Bercom

unread,
Oct 27, 2011, 6:04:23 PM10/27/11
to fir...@googlegroups.com
Hello Jan,

sorry for late response but you were right, it seems as my misspelling was the issue (funny though it didn't cause any error/warning in compilation or in runtime)

I have used the following preferences (C#) with success:


                profile.SetPreference("extensions.firebug.currentVersion", "1.8.2"); //remove first run tab
                profile.SetPreference("extensions.firebug.netexport.alwaysEnableAutoExport",true);
                profile.SetPreference("extensions.firebug.netexport.defaultLogDir",output_dir);
                profile.SetPreference("extensions.firebug.netexport.showPreview", false);

                profile.SetPreference("extensions.firebug.allPagesActivation", "on");
                profile.SetPreference("extensions.firebug.net.enableSites", true);

Thanks


2011/10/2 Jan Honza Odvarko <odv...@gmail.com>
Message has been deleted

Jan Honza Odvarko

unread,
Jan 21, 2013, 6:40:37 AM1/21/13
to Firebug
On Jan 20, 8:17 pm, Guo Li <gli00...@gmail.com> wrote:
> Hi Guys,
>      I am new to netexport, can someone show an example  how to set it to
> auto-export in JSONP format?
> I  am using
>
> profile.addExtension(new File(
>                     "/Users/guo/netExport-0.9b3.xpi"));
> and it does have a save as jsonp option.
Such option should be easy to add

Here is the place where the JSONP modification should be done:
https://github.com/firebug/netexport/blob/master/chrome/content/netexport/automation.js#L176

And here is how it's done for manual export
https://github.com/firebug/netexport/blob/master/chrome/content/netexport/exporter.js#L103

Please create a new report here:
http://code.google.com/p/fbug/issues/list

...and I'll fix it. Or you can also provide a patch.

Honza

Guo Li

unread,
Jan 29, 2013, 11:58:49 PM1/29/13
to fir...@googlegroups.com
Hi Guys,
    Does netexport auto-export always work for you?

I am using java + selenium jar   with "netExport-0.9b3.xpi" and  "firebug-1.10.0.xpi";

I found
driver.get("http://www.google.com") will create  har like 'www.google.com+2013-01-29+20-26-02.har'
but
driver.get("file:///Users/me/tmp/tag0.html")
gets NO har dumped,  but I can see the page loaded in friefox.

here tag0.html source looks like:

<html>
<body style='background-color: #f496a1;'>
<p>
<iframe name="iframe1" width="600" height="400" src="http://en.wikipedia.org/wiki/" frameborder="yes" scrolling="yes">
</iframe>
<p>
<textarea rows="20" cols="50" wrap="off" id="hopstats">Empty</textarea></body>
</html>



I tried to play with  profile.setPreference("extensions.firebug.netexport.pageLoadedTimeout",
                2000);

No luck at all, anybody seen such issue , any ideas?

Thanks,
Guo



On Sun, Jan 20, 2013 at 11:17 AM, Guo Li <gli0...@gmail.com> wrote:
Hi Guys,
     I am new to netexport, can someone show an example  how to set it to auto-export in JSONP format?
I  am using

profile.addExtension(new File(
                    "/Users/guo/netExport-0.9b3.xpi"));
and it does have a save as jsonp option.

Thanks,
Guo

--
You received this message because you are subscribed to the Google
Groups "Firebug" group.
To post to this group, send email to fir...@googlegroups.com
To unsubscribe from this group, send email to
firebug+u...@googlegroups.com
For more options, visit this group at

Jan Honza Odvarko

unread,
Jan 30, 2013, 6:00:55 AM1/30/13
to Firebug
On Jan 30, 5:58 am, Guo Li <gli00...@gmail.com> wrote:
> Hi Guys,
>     Does netexport auto-export always work for you?
>
> I am using java + selenium jar   with "netExport-0.9b3.xpi" and
> "firebug-1.10.0.xpi";
>
> I found
> driver.get("http://www.google.com") will create  har like 'www.google.com
> +2013-01-29+20-26-02.har'
> but
> driver.get("file:///Users/me/tmp/tag0.html")
> gets NO har dumped,  but I can see the page loaded in friefox.
You need to use http: protocol

Honza

Guo Li

unread,
Feb 3, 2013, 1:14:52 PM2/3/13
to fir...@googlegroups.com
Hi Honza,
    When I am using diver.get("file://..."), I can see that firebug net panel does capture all the requests/responses, in this case, I guess it should be a trivial task for netExport to dump them, how come the url has to be like "http://..."   for netExport to export?

Thanks for your time.
Guo


--

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

---

You received this message because you are subscribed to the Google Groups "Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebug+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Jan Honza Odvarko

unread,
Feb 4, 2013, 2:51:52 AM2/4/13
to Firebug
On Feb 3, 7:14 pm, Guo Li <gli00...@gmail.com> wrote:
> Hi Honza,
>     When I am using diver.get("file://..."), I can see that firebug net
> panel does capture all the requests/responses, in this case,
Interesting, if I type e.g.: file:///C:/tests/simplePage.html
in Firefox address bar, open Firebug, enable the Net panel and reload
I don't see any requests in the Net panel.

Can you try it? (with no Selenium)

> I guess it
> should be a trivial task for netExport to dump them,
Yes, netExport just reads Net panel's content...

Honza

Guo Li

unread,
Feb 4, 2013, 1:03:04 PM2/4/13
to fir...@googlegroups.com
Hi Honza,
     Please kindly check the attachments (html and screenshot png), and please load the html in firefox, enable firebug, refresh the page again, I would be shocked if  you can not get the same screenshot. :-)
Or maybe your firefox has some setting that prevents iframe?
this operation  has nothing to do with java/selenium.

Thanks a lot,
Guo



Honza

jan.html
jan.png

Jan Honza Odvarko

unread,
Feb 5, 2013, 12:34:57 PM2/5/13
to Firebug
Hi Guo,
yep, I can reproduce the problem on my machine.

Could you please file a new issue report here:
http://code.google.com/p/fbug/issues/list
(please attach the same files)

and I’ll take a look at it.

Thanks!
Honza

Guo Li

unread,
Feb 6, 2013, 8:32:51 PM2/6/13
to fir...@googlegroups.com
issue created
http://code.google.com/p/fbug/issues/detail?id=6250

Thanks,
Guo


Honza

Guo Li

unread,
Feb 6, 2013, 8:49:37 PM2/6/13
to fir...@googlegroups.com
Hi Guys,
    I also found that netexport auto-dump seems diff than manually click the export button, I have a test html which has iframe and javascript tag that will finally dispaly a flash,  manually-exported har does contain a response with content-type as

application/x-shockwave-flash
and the corresponding request is actually the url for a flash,  this is working as expecetd,

BUT,

if using auto-export, then the generated har does not have that, the har instead  contains a response with content.mimeType as text/html, and the text is a html page source which contains string like
'<embed allowScriptAccess=\"always\" quality=\"high\" salign=\"LT\" loop=\"true\" type=\"application/x-shockwave-flash\"

I would hope the auto-exported har will look exactly the same as the manually-exported one. I tried to increase this:

profile.setPreference("extensions.firebug.netexport.pageLoadedTimeout",
                5000);
and let the program wait for a while after driver.get(...)
Thread.sleep(6000)
No luck.

Anybody know how to fix this?

Thanks,
guo

Jan Honza Odvarko

unread,
May 23, 2013, 12:49:16 AM5/23/13
to fir...@googlegroups.com


On Thursday, May 23, 2013 12:10:48 AM UTC+2, web...@adaptiveaudience.com wrote:
Jan Honza Odvarko,

Can you show your entire php example (or point me to an entire php example) that accesses and uses a firefox addon extension?  I'm trying to use php and selenium for testing, but I don't see any examples except for your small excerpt that actually use an addon.  I have to use a ibm firefox addon/extension that logs in and then push a button on that addon/extension to produce a report.  Any complete examples that do any of that in php would be very helpful.  Thank you for your time and have a great day!
 
The entire source code is published in this post:
http://www.softwareishard.com/blog/firebug/automate-page-load-performance-testing-with-firebug-and-selenium/

Honza
Reply all
Reply to author
Forward
0 new messages