Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to use looping statement
#1
Solved: 7 Years, 2 Months, 2 Weeks ago
Hi, Good day to all, currently using UFT v14

I wanted to loop lines 1-13 using the data table which has 6 rows then after that run lines 14-16 once.
What statement would be best to use? currently it runs 6 times login to logout. Thanks in advance for your comments


Code:
1. Browser("VMware Service Manager").Page("VMware Service Manager").Link("Log a Call").Click
2. Browser("VMware Service Manager").Page("VMware Service Manager").Link("APAC").Click
3. Browser("VMware Service Manager").Page("VMware Service Manager").WebList("EXTFLDV_500064").Select DataTable.Value("EXTFLDV_500064", "Action1") 
4. Browser("VMware Service Manager").Page("VMware Service Manager").WebEdit("Contact_No").Set DataTable.Value("Contact", "Action1") 
5. Browser("VMware Service Manager").Page("VMware Service Manager").WebList("URGENCY_REF").Select DataTable.Value("URGENCY_REF", "Action1") 
6. Browser("VMware Service Manager").Page("VMware Service Manager").WebList("IMPACT_REF").Select DataTable.Value("IMPACT_REF", "Action1") 
7. Browser("VMware Service Manager").Page("VMware Service Manager").WebEdit("EXTFLDV_400136").Set DataTable.Value("EXTFLDV_400136", "Action1")
8. Browser("VMware Service Manager").Page("VMware Service Manager").WebEdit("HTMLTEXTAREA_PROBLEM_DESC").Set DataTable.Value("HTMLTEXTAREA_PROBLEM_DESC", "Action1")
9. Browser("VMware Service Manager").Page("VMware Service Manager").WebButton("Submit").Click
10.  If Browser("VMware Service Manager").Page("VMware Service Manager").WebElement("innertext:=A new call has been logged with the following details:").Exist(4)Then 
11.    Browser("VMware Service Manager").Page("VMware Service Manager").Link("Log a Call").Click
12. End If
13. Wait(2)
14. Browser("VMware Service Manager").Page("VMware Service Manager").Link("Log Out").Click
15. Browser("VMware Service Manager").Page("VMware Service Manager").WebButton("OK").Click
16. Browser("VMware Service Manager").CloseAllTabs
Reply
#2
Solved: 7 Years, 2 Months, 2 Weeks ago
This is a classical UFT quiz/certification question Smile

Put login/logout data in global data sheet and rest of the data which needs to be repeated in action sheets.

So if you have to login once and then do iteration for 20 times and then logout. Put the login info once in global table, put 20 lines worth of data in action table and then a logout action.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Excel_Datasheet Looping problem Saadat Chowdhury 0 1,748 10-05-2012, 08:42 AM
Last Post: Saadat Chowdhury
  problem in looping statements... navyasatish 5 4,237 02-02-2012, 02:23 PM
Last Post: rajpes
  Looping wont stop laura 3 3,198 07-06-2009, 02:11 PM
Last Post: basanth27
  Looping and seting value laura 5 3,714 07-03-2009, 01:13 PM
Last Post: Ankur
  Code won't stop looping through imported spreadsheet Mike72688 6 5,807 01-08-2009, 07:21 PM
Last Post: Mike72688

Forum Jump:


Users browsing this thread: 1 Guest(s)