Micro Focus QTP (UFT) Forums
Read the HTTP response inside QTP script - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Read the HTTP response inside QTP script (/Thread-Read-the-HTTP-response-inside-QTP-script)



Read the HTTP response inside QTP script - xcoder2 - 03-30-2009

Hello,

I have an action that performs navigation to a certain url. After that I want to read the HTTP response that was returned. I need to check some headers. How do I do that in QTP?

The navigation is done like this:

Code:
Browser("Browser").Navigate Parameter("url")

Regards,
x


RE: Read the HTTP response inside QTP script - anil2u - 10-14-2013

Hi,

You got to use an asynchronous call with the URL and then get back the response body.

From what I could remember,

Code:
Set httpObj = CreateObject("MSXML2.XMLHTTP")
httpObj.open "GET","Your URL", FALSE  /*(False makes an asynchronous call)
httpObj.send

msgbox httpObj.responseText

there are other methods and properties such as getResponseHeader(method) & responseBody(property), which can be used according to your requirement. For more information just check the msdn library for the object MSXML2.XMLHTTP

Hope this helps.

Cheers,
Anil