Open In App

How to make Automation Projects using Postman ?

Last Updated : 07 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will be seeing how you can use postman to make automation projects. This article will also help many developers and Penetration testers instead of Burp suite. You can also call postman interceptor as the mini version of Brupsuite Interceptor. Postman is a cutting-edge Automation tool, which can be used for API testing, Automated Unit testing, and Integrated testing. We will be using Postman Interceptor to capture the requests for automation.

Using Postman Interceptor: Postman Interceptor is a Chrome extension that acts as a browser companion to the Postman Desktop app. Interceptor enables you to capture network requests and cookies directly from a Chrome browser. Once Interceptor is running in Chrome, you can start a debug session, which is a time-bound session of traffic capture. You can start, pause, and stop an interceptor debug session, then later start another one. Each debug session is logged in the History tab and displays the total session time and all traffic captured. From the logged session, you can send requests and responses to a collection and save cookies to the Postman cookie jar.

Following are the detailed steps:

Step 1: Download and Install the postman app: https://www.postman.com/downloads/.

 

Step 2: Add the Postman Interceptor Extension to your Chrome Browser.

 

Step 3: Open the Postman Application.

Step 4: Click on the capture requests at the bottom right of the application.

 

Step 5: Click on the “via Interceptor” Tab.

 

Step 6: Mark the Capture cookies as yes and click on Start capture.

 

Step 7: Go to the website in your browser that you wanted to automate.

 All the API calls are recorded in the postman application

      

Step 8: Browse through all the API calls in your postman application and find your API.

Click on the API 

 

Step 9: After Finding the API call and click on the “</>” named icon at the right of the application and select the language you wanted to code.

 

 

Python




import requests
  
  
payload={}
headers = {
  'sec-ch-ua': '" Not A;Brand";v="99"
      "Chromium";v="100", "Google Chrome";v="100"',
  'sec-ch-ua-mobile': '?0',
  'sec-ch-ua-platform': '"Windows"',
  'Upgrade-Insecure-Requests': '1',
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36',
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
  'Purpose': 'prefetch',
  'Sec-Fetch-Site': 'none',
  'Sec-Fetch-Mode': 'navigate',
  'Sec-Fetch-User': '?1',
  'Sec-Fetch-Dest': 'document',
  'host': 'www.geeksforgeeks.org'
}
  
response = requests.request("GET"
     url, headers=headers, data=payload)
  
print(response.text)


Step 10: Copy the code to your project and make necessary changes according to your requirement You can Refer Here to how to read the Response of an API call.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads