This QTP program demonstrate that how to use arrays in QTP script. Steps involve in program development.
1. Create a array of 2x2 that can contain 4 elements, Please note that to declare 4 element array you need to write Dim QTPArray(1,1) , which is different from other array declaration.
2. Assign the value to array.
3. now you need two for loops to print the values of array.
4. keep one for loop inside another.
Using of Array in QTP:
<html>
<body>
<script type="text/vbscript">
Dim QTPArray(1,1)
QTPArray(0,0)="TestingWiz.com"
QTPArray(0,1)="CsharpTalk.com"
QTPArray(1,0)="SharepointBank.com"
QTPArray(1,1)="BharatClick.com"
for i=0 to 1
document.write("<p>")
for j=0 to 1
document.write(QTPArray(i,j) & "<br />")
next
document.write("</p>")
next
</script>
</body>
</html>
Output of above QTP Program:
Where to run this program:
1. This VBScript Program code either you can use in QTP editor (Copy only code inside the <script> </script> block) and run it.
2. Write in Notepad, save with .htm extension and run on internet explorer.
0 comments:
Post a Comment