How to count the no of objects in XML file(QTP)

Answer Posted / uday kumar_anem

' To find the number of child elements for a specified
parent
Set doc = XMLUtil.CreateXML()
doc.LoadFile "e:\sample.xml"
Set elementCol = doc.ChildElementsByPath
("/Environment/Variable")
temp=elementCol.Count
msgbox(temp)

'To Find the numer of child elements for a root
Set doc=XMLUtil.CreateXML()
doc.loadfile "e:\sample.xml"
Set root = doc.GetRootElement()
temp=root.ChildElements().count
msgbox(temp)

My sample XML file is like:
<Environment>
<Variable>
<Name>Name</Name>
<Value>Uday Kumar</Value>
</Variable>
<Variable>
<Name>Designation</Name>
<Value>Senior Software Engineer</Value>
</Variable>
</Environment>

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is checking bitmaps?

548


How does qtp identify objects in the application?

581


What is the short cut keys for the following?

638


Explain qtp(quick test professional)?

572


What is RTM (require ment tracebulity marix) fromate?

1522






What is the Difference between test object and run time object?

605


Hi friends did any budy attend accenture system test for qtp? if any budy pls drop questions.not only accenture any other mnc company which you attended system test(QTP)?it may helpful to others also

1861


Explain different types of action in qtp?

568


Do you know how to connect database? Can you tell me the procedures?

543


What are the types of object repository?

574


Mention the test steps of qtp.

536


How many test scenarios you have automated? How many time it will take to execute 30-40 scenarios? What SDLC model you are following? How often you will execute your test scripts? Because of some changes, your test scripts failed? When you will update your test scripts? How much time it will take to update? Do you know how to connect database? Do you know the direct method to count no. of records (or) rows present in record set once query is executed? How will you create the connection string? How did you resolve conflicts present in Object Repository? How good you are in VB? How will you work on Excel Application? How will you select Excel sheet? If you want to select 10 sheets, will you create 10 separate objects? Given string is “abcd”. What are the methods you will use to display “dcba”? Drives script – explain the frameworks? How you are updating results for each test? What is start up, configuration, navigation scripts? If you are not able to understand the application (some module), who will teach you? What test cases to be automated? When to be automated? What is the testing process you are following? What life cycle you are following? When you will use Descriptive Programming? Do you have the permission to add objects into shared object repository? (OR) someone will maintain SOR? Do you know how to add objects into shared object repository? How many test cases you have automated? How much time will it take to execute? What is complex in automation? When you feel automation is complex? Tell me one scenario, the complex functionality you have automated in your project? Excel sheet having some datas and some datas present in the application (in table). How will you compare these two datas? Write code to fetch datas from Excel sheet. Rate yourself in SQL? Display the employee name who is getting maximum salary? sal ID Salary name 001 100 002 500 003 300 ID 001 002 003 Ename A B C Have you written any test cases while you are in Automation? Manual Testing also will you do or you will work only in automation?

2223


What is the syntax to call one action in another?

548


i have to login into gmail loginpage i have to pass testcase into userid and password by using functions. the test case of user id is it should take only lowerletters alphabetin between 4 to 6 length.it should not take spectial letters.it should not take numbers.testcase for password is it should take numbers and it should not take alphabets note the following things must happen 1 when i give correct password and userid that password and userid should be seen in QTP result and notepad,xl sheet 2 when i gave in valid password the system willgive message please give valid password that particular messaage should be seen in QTP result,norepa and xl sheet

1754


Where can I find and view run-time data table?

517