Hey Parke I luk to call a function Login (usr, pw, result) stored in excel. However the moment its fetched from excel it is stored in variable as string and call to that variable turns into a call to a string returning an error.
Any suggestions please..... Regards Dinesh On Sunday, August 4, 2013, Parke Kuntz <[email protected]> wrote: > Jay: > > Take a look at http://www.sqaforums.com/showflat.php?Number=703047. > > hth, > > > Parke > > On Fri, Aug 2, 2013 at 1:39 PM, jay rawat <[email protected]> wrote: >> >> ''//Declarations needed >> Const usr = "Auto00" >> Const pw = "fis@1230" >> test_Link = "http://billerconsole.html" ''//example link here >> DriverSheet = "C:\Driver.xls" >> >> Now when I run below code then in msg box "Login (usr, pw, res)" should get displayed which is actually symbolizes call to Login fn from Function Library mentioned below. >> However, value fetched in fn varaible from excel sheet will be fetched as string so writing Call fn, will never run fn function and will bring error as call is to a string value fetched from excel and not to fuction entered in excel. >> I want to fetch value from excel as function call in fn variable >> Set objExcel = CreateObject("Excel.Application") >> objExcel.Visible = True >> objExcel.DisplayAlerts = False >> Set obj_Driver_WB = objExcel.Workbooks.Open (DriverSheet) >> Set obj_Driver_WS = obj_Driver_WB.Worksheets(1) >> fn = obj_Driver_WS.Cells(1, 1).value >> obj_Driver_WB.Save >> obj_Driver_WB.Close >> objExcel.Quit >> msgbox fn >> >> >> Call fn >> >> >> >> Public Sub Login (fusr, fpwd, result) >> result = "false" >> Cust_LaunchBrowser(test_Link) >> Browser("Biller Console").Page("Biller_Login").WebEdit("txt_loginid").Set fusr >> Browser("Biller Console").Page("Biller_Login").WebEdit("txt_password").Set fpwd >> Browser("Biller Console").Page("Biller_Login").WebButton("btn_Log in").Click >> >> wait (5) >> msg_Logo = Browser("Biller Console").Page("Admin").Frame("Header").WebElement("we_Biller").GetROProperty("innertext") >> >> If trim(msg_Logo) = "Biller" Then >> Reporter.ReportEvent micPass, "Login", "User successfully logged in Biller" >> result = "true" >> Else >> 'msgbox "failed" >> Reporter.ReportEvent micFail, "Login", "User successfully logged in as different Biller" >> result = "false" >> End If >> >> End Sub >> >> Public Sub Cust_LaunchBrowser(furl) >> ' On Error Resume Next >> Set IE = CreateObject("InternetExplorer.Application") >> IE.Visible = true >> IE.Navigate furl >> IE.Left =0 >> IE.Top =0 >> IE.Height = 740 >> IE.Width = 1025 >> launchBrowser=true >> 'Set IE = Nothing >> ' On Error Goto 0 >> End Sub >> >> -- >> -- >> 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 >> >> --- >> You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. >> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > > -- > Parke > Cell: 770-842-0121 > > -- > -- > 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 > > --- > You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
