How to retrive XML file data in QTP ? using Script(Chandana)

Answers were Sorted based on User's Feedback

Answer / kr

In QTP9.0 it supports XML input also same as in
QTP8.2 we can import .xml files into user defined
Environment Variable section.

Is This Answer Correct ?    10 Yes 0 No

Answer / sandipgami84

Hi Chandana,

u can retrive data from database(XML fromet)..

u can use SQL..
LIKE e.g. Select * FROM TableName For XML Type, AUTO

Cell No: 09986645937

Is This Answer Correct ?    6 Yes 0 No

Answer / fayaz

We can load environment variables from an xml file.

File --> Settings and click the "Environment" tab

You can see a check box "Load environment variables "

check it and give the path of the xml file.

when u run QTP , the variables in XML file will be
And you can retrieve those values using Environment.value
("variable_name") from any actions.

Hope this will answer your question

Is This Answer Correct ?    7 Yes 4 No

Answer / nidhi jain

Chandan, below is solution

Const XMLDataFile = <your file path>

Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False

Set nodes = xmlDoc.SelectNodes(<provide you node hierarchy>)
MsgBox "Total books: " & nodes.Length

Set nodes = xmlDoc.SelectNodes("<node hierarchy>/text()")

' get their values
For i = 0 To (nodes.Length - 1)
Title = nodes(i).NodeValue
MsgBox "Title #" & (i + 1) & ": " & Title

I hope this will be helpful.

Is This Answer Correct ?    8 Yes 5 No

Answer / reddy

shilpa u can not understanding what is the requirement of
what she asking is how to retrieve xml file data using
script in qtp

ex: u have data in datatable that all the will be retrive
in xml format using script

Is This Answer Correct ?    3 Yes 1 No

Answer / shilpa reddy

chandana,we cannot apply xml data directly to script,first
we should import data into runtime datatable using import
sheet/import methods.using datatable methods we can apply
this values in our required location in the script.I
provided script for this in further answers,check it out

Is This Answer Correct ?    3 Yes 9 No

Post New Answer

More QTP Interview Questions

how we can take data in the username field text box into variable in web application explain with example and give all functions to get data into variables

1 Answers  

What is load testing?

1 Answers   Crea,

What is iteration? How it is related to Test Results in QTP

3 Answers   Virinchi Technologies,

Does QTP provides any tools for parametarization?

3 Answers   BirlaSoft,

I have a tool for automation testing (eg:qtp).I have two functionality(A & B) to test.A is tested once in a year. B is tested everyday. At present i have the money and resource availability to automate only one functionality.Which one will u suggest and why?

3 Answers   Wipro,

I want different types of discriptive programming statments coded for different types of web-objects?Give syntax and example?

2 Answers  

what is run-time data?

0 Answers  

Where virtual objects stores results?

4 Answers  

I'm quite new at QTP. Im doing a web-based app testing. I create something new item and a new link is created in the home page. This link is dynamic as it changes every 3 seconds. Obviously the new link is not in my Object Repo and I am trying to find a way how can I do a check or get the propery of the link I created. I can do it on keyword, but I need to do a check on expert mode, vbscript. I always get an error that is not identified whenever i try to check it (browser(b),page(p).link(newlink). Any idea?

4 Answers  

What is the advantage of associating a procedure with a test object?

1 Answers  

how can i call an external action,which is not added external action of an action?

2 Answers   Ordain Solutions,

can any one make me confirm about a real time employee with better experience in QTP who is providing QTP course individually in Bangalore???

3 Answers