Selenium-RC: Is there a way to sniff the incoming/outgoing HTTP requests
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 开发者_StackOverflow中文版isn't what's the most convenient way of doing this?
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());
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?
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
精彩评论