Sridhar makes a good point. Functions in an external resource should be generic and not dependant on objects unless maybe you are using descriptive programming such that it doesn't need to rely on object repositories.
Your login can be stored as a reusable action and you can call that action from any of your tests. Cheers, MWF On Tue, Feb 16, 2010 at 11:54 AM, b sridhar <[email protected]> wrote: > Hi Chinna, > > The function which you have created for Login is not a appropriate solution > for a QTP script. > > Usually in QTP function library (.vbs) is used for generic functions ,Why > becoz u could not able to associate the Object Repository to the function > library .So,If u specify objects Ex:Browser("Google"),Page("Gmail: Email > from Google"),WebEdit("Passwd") in function library file will not work > Example for generic functions: > > Function DisplayFutureDate() > DisplayFutureDate=AddDate() > End Function > > You have to create the Login Reusable action for reusable purpose instead > of specifying a login function. > Hoping that i have clarified the use of function library > > Thanks > Sridhar > > > > > > On 2/16/10, chinna <[email protected]> wrote: >> >> >> >> acutally I developed script for gmail longing page and i save that script >> in .vbs >> after that i can associate the script using setting options >> which code i want write in qtp to run below function >> >> >> Function gmail_login() >> Browser("Google").Page("Google").Sync >> Browser("Google").Navigate "http://www.gmail.com/" >> Browser("Google").Page("Gmail: Email from Google").WebEdit("Email").Set >> "chinna" >> Browser("Google").Page("Gmail: Email from >> Google").WebEdit("Passwd").SetSecure >> "4b794bc217051ee02a5f36e7f80642cf4e1d887102eff397" >> Browser("Google").Page("Gmail: Email from Google").WebButton("Sign >> in").Click >> If Browser("Google").Page("New! Google Buzz in Gmail").Link("Nah, go to my >> inbox").Exist(3) Then >> Browser("Google").Page("New! Google Buzz in Gmail").Link("Nah, go to >> my inbox").Click >> End If >> Browser("Google").Page("Gmail - Inbox (5)").Frame("v1").Link("Sign >> out").Click >> Browser("Google").Page("Gmail: Email from Google_2").Sync >> Browser("Google").Close >> End Function >> >> -- >> Thanks & Regards, >> Chinna, >> Mob:9739656841 >> >> -- >> 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]<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
