set obj=Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury")
you can use object "obj" where ever u want..
other wise u can aslo try the code with "WITH" Statement available in qtp..
this feature in can get under EDIT menu in qtp.Regards, Vamsi On Wed, Jan 19, 2011 at 2:37 PM, avinash vl <[email protected]> wrote: > Hi all, > > I've wrote a peace of code, but it is lengthy, with lot of variable and > steps. I don't think is correct way write. > Could you please help me to reduce steps for the code below:- > > Browser("Welcome: Mercury Tours").Page("Welcome: Mercury > Tours").WebEdit("userName").Set "tutorial" > Browser("Welcome: Mercury Tours").Page("Welcome: Mercury > Tours").WebEdit("password").SetSecure > "4d368a0199b271debc76b1efa71c64cb420e1c2b87cc" > Browser("Welcome: Mercury Tours").Page("Welcome: Mercury > Tours").Image("Sign-In").Click 29,8 > Browser("Welcome: Mercury Tours").Page("Find a Flight: > Mercury").Image("findFlights").Click 41,6 > Browser("Welcome: Mercury Tours").Page("Select a Flight: > Mercury").Image("reserveFlights").Click 63,19 > Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Output > CheckPoint("Book a Flight: Mercury Tours") > Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Output > CheckPoint("Book a Flight: Mercury Tours_2") > Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Output > CheckPoint("Book a Flight: Mercury Tours_3") > Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Output > CheckPoint("Book a Flight: Mercury Tours_4") > Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Sync > Browser("Welcome: Mercury Tours").CloseAllTabs > > Dim arrival, depart,tax,total, a,b,c,p,x ,y,z > arrival = datatable.Value("from",dtGlobalSheet) > depart = datatable.Value("to",dtGlobalSheet) > tax = datatable.Value("tax",dtGlobalSheet) > total = datatable.Value("total",dtGlobalSheet) > > a = replace (tax , "$","") > b= replace (total, "$" ,"") > > p = cint (arrival) > x = cint (depart) > y= cint (a) > z = cint (b) > c = p+x+y > If c = z Then > reporter.ReportEvent micPass,"totalCheckAmt","Total amount is correct" > else > reporter.ReportEvent micFail,"totalCheckAmt","Total amount is wrong" > End If > > > > > Thanks and regards, > Avinash > > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<mercuryqtp%[email protected]> > For more options, visit this group at > http://groups.google.com/group/MercuryQTP?hl=en -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en
