views:

315

answers:

3

Like HTTP Headers in firefox, I would like to save all the HTTP requests and responses (more importantly requests) that are sent/received during the run of selenium.

Is there a built-in tool or do I have to combine the script with wireshark/fiddler? if there isn't what's the most convenient way of doing this?

A: 

Can you not use selenium IDE from firefox (that is how I run selenium scripts), and use http headers / firebug to trace it? Another more scriptable alternative to wireshark is tcpheaders, perhaps that fits you better?

disown
A: 

I believe you can simply enable xml capturing. I used this for a while and it works great, I now use HtmlUnit.

This will save the http headers and response body. When you instantiate the Selenium instance, you need to pass a constructor argument ("xmlhttp") or something to that effect.

Walter

+1  A: 

In actuality, if you're looking just for headers you could use the captureNetworkTraffic start option

so

Selenium selenium = new DefaultSelenium("http://www.google.com/", "*firefox");
selenium.start("captureNetworkTraffic=true");
System.out.println(selenium.captureNetworkTraffic());
Zachary Spencer