There are a number of reasons you may want to record or monitor HTTP traffic.
I did it as I wanted to reduce the reliance on using the UI and therefore Selenium for my automated tests.
I decided that if I was able to turn some of the UI navigation into simple API calls, I could reduce the test run time whilst at the same time increasing the robustness and reliability.
Other reasons may include looking to intercept any redirects that the browser could be making automatically or being able to review requests being made.
To do this we’ll be using a popular API development tool called Postman.
1. Install Postman
The first thing you want to do is download postman from here: link to download page.
As mentioned above, Postman is a popular API development tool that can allow users to make HTTP calls, it can act as the browser without the user interface.
I would advise installing the app through the chrome store. This allows a direct connection to the browser and will save you having to configure a proxy in Postman to connect the application to the browser.
Although it is a chrome plugin, it will install as a standalone application that can be run outside of the browser.
2. Install Postman Interceptor
Once you have postman installed its time to install Postman Interceptor. This Chrome plugin allows you record and monitor HTTP traffic.
Once installed the ‘Postman Interceptor’ icon will appear alongside your other plugins. Once you click on the icon all you have to do is switch the slider to the ‘ON’ position.
The request should start to appear within this window.
3. Turn on the Interceptor
Now back to Postman, (which should be installed and opened by now), click the Interceptor icon and also turn that slider into the ‘ON’ position.
4. Browse and record traffic
Go back to your browser (where we earlier turned on the interceptor) and browse as you would. Going back to Postman you should now see all of the request that are being made, all recorded within the left-hand panel.
Why this over the network tab within your browser?
I find that postman does a very good job of only recording the calls that you are making. Most application on the web makes many more calls in the background. This could be from downloading images to sending analytics data. This can make all the requests very difficult to sieve through. You’ll find that Postman is very good are keeping everything simple and easy to follow