Certified Selenium Professiona Learning Resources Network traffic capture

Learning Resources

Network traffic capture

Selenium offers a feature, captureNetworkTraffic, which allows you to intercept the network traffic as seen by the browser running your test.
The response includes headers, status codes, timings and ajax requests. It’s especially useful if you’re debugging requests in your browser.

To be able to capture network traffic one should start selenium instance as -


and then launch the application usual way. Once you reach a point after which n/w traffic is to be captured then fire following method -


We can pass - "xml", "plain" or "json" as parameter to this method. Since its return type is String, we can assert presence of any specific request on the response received


 For Support