Make Selenium Easy

Postman Tutorial Part 53 – Extracting Value From XML Response in Postman

As a part of Postman Tutorial – End to End , in this post, we will learn how can we extract value from XML response in Postman.

Already, we learnt how can we send a XML and parameterized XML payload in Postman. In this post we will learn to extract values form XML response and assert.

Extracting or parsing XML response in Postman is little tricky. Let’s learn it.

Consider XML response as below :-

First you need to convert above XML response to JSON.

var response = xml2Json(responseBody)

This “response” will be root node similar to <head> tag in html DOM. Now we need to travel node by node. For example:- To reach node “firstName”, you need to start from root node -> created-booking – > booking -> firstname. It is similar to absolute XPath.

syntax:- rootNode[“node1”][“node2”][“node3”]

Let’s write whole code for above XML response :-

Import above example collection from here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

Table of Contents

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

1 thought on “Postman Tutorial Part 53 – Extracting Value From XML Response in Postman

  1. Special thanks to you for covering the various aspects of postman. It was great to see 53 tutorials

    When we have already converted xml2json why do we need to access like [][] and not by .

    Can you cover them how to save this as code repository?
    Cover other methods as well

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.

Postman Tutorial Part 53 – Extracting Value From XML Response in Postman

by Amod Mahajan time to read: 2 min
%d bloggers like this: