Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

If yes, how is it called, or where can I find more info about it? (I'm not talking about using WebDriverBackend.)

If not, what alternatives are there?

share|improve this question
    
I may eventually do that, but rather look for native webdriver solutions. –  Roni Yaniv Jun 27 '11 at 11:26
    
Question has been answered, but many people on SQA cannot find answer to this problem, and are duplicating the question. Could we add more context to the question regarding the problem. For instance, this [sqa.stackexchange.com/questions/2915/… question) describes it very clearly and from more general perspective, IMHO. –  dzieciou Nov 1 '12 at 7:50

3 Answers 3

up vote 11 down vote accepted

You can capture network traffic using a proxy, such as the BrowserMob Proxy (http://proxy.browsermob.com)

To configure the use of the proxy with a webdriver instance, set the CapabilityName.PROXY value to a org.openqa.selenium.Proxy instance:

Proxy proxy = new Proxy();
// The URL here is the URL that the browsermob proxy is using
proxy.setHttpProxy("localhost:9100");

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.PROXY, proxy);

WebDriver driver = new FirefoxDriver(capabilities);

Once the test is finished, you can extract the data from the browsermob proxy using the mechanisms it provides. Notice that you can also use any proxy you want: it need not be the browsermob one!

share|improve this answer
    
Does using a proxy slow down the test? –  A.J May 16 '12 at 19:57
    
and then how do you check the value from the proxy in the test? ...yet another whole system to maintain and to add false positives. –  gcb Oct 26 '12 at 23:08

Haven't looked through it all yet, but I did find a post that seems related. Also, haven't tried it out, but, have you looked at any of the fiddler libraries? Although I have plans on trying them out, it's not going to be for a few months yet.

share|improve this answer
    
Looks interesting, but I'm looking for a more complete solutions, maybe requiring the usage of two tools (like selenium and gson, in my case). This looks like a lot of work to accomplish this thing. –  Roni Yaniv Jun 27 '11 at 11:25

No there is no native solution at the moment. If you use webDriverBackedSelenium you can try to utilise the captureNetworkTraffic functionality, however there were issues with it last time I heard it talked about (See here for more info - https://groups.google.com/d/topic/selenium-users/fMSHeH9ZVqU/discussion).

It's also worth noting that captureNetworkTraffic only works in FireFox due to the way it was implemented so it's not a cross browser solution.

*Update*

Based on some information that came through the selenium/webdriver mailing lists you can use a proxy instead (Suggested one is http://proxy.browsermob.com/, although there are others).

To configure it:

 Proxy proxy = new Proxy();
 proxy.setHttpProxy(<proxyAddress>);
 DesiredCapabilities ap = DesiredCapabilities.firefox();
 cap.setCapability(CapabilityType.PROXY, proxy);
 WebDriver driver = new FirefoxDriver(cap);

This should currently work for FireFox and IE. It looks like this is going to be the way to capture network traffic moving forward.

Note: "new Proxy()" - Needs org.openqa.selenium.Proxy.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.