Hi Everyone,
Here i m extracting login details from excel..when extracting the data it
throws a runtime error..please check and suggest me with solution.
I attached excel doc for reference.
testcase = Environment.Value("TestName")
surl = fngetdata("url")
systemutil.Run"iexplore.exe",surl
'Browser("Gmail").Page("Gmail").Sync
' Browser("Gmail").Page("Gmail").WebEdit("Email").fnsetval "UserName"
' Browser("Gmail").Page("Gmail").WebEdit("Passwd").fnsetval "password"
' Browser("Gmail").Page("Gmail").WebButton("Sign in").Click
' Browser("Gmail").Page("Inbox .*").Sync
Browser("Gmail - Email from Google").Page("Gmail - Email from
Google").Link("Sign in").Click
Browser("Gmail - Email from Google").Page("Gmail").WebEdit("Email").Set
Browser("Gmail - Email from Google").Page("Gmail").WebEdit("Passwd").Set
Browser("Gmail - Email from Google").Page("Gmail").WebButton("Sign
in").Click
Browser("Gmail - Email from Google").Page("Inbox.*").Sync
ur = Browser("Gmail - Email from
Google").Page("Inbox.*").Link("Inbox").GetROProperty("innertext")
If Right(ur,1)=")" Then
sur=split(ur,"inbox(")
num=right(sur(1),len(sur(1)-1))
End If
Reporter.ReportEvent micDone,"no of unread mails",num
Function fngetdata(strcolname)
Set oxl=Createobject("Excel.Application")
Set owb=oxl.Workbooks.Open("C:\Documents and Settings\Administrator\My
Documents\QTP\datadriv\DataSheet.xls")
Set ows=owb.sheets("TestData")
ur=ows.usedrange.rows.count
uc=ows.usedrange.columns.count
For ic=2 to uc
If ows.cells(1,ic).value = strcolname Then
reqcol = ic
Exit For
End If
For i=2 to ur
If ows.cells(i,1).value = testcase Then
fngetdata = ows.Cells (i,reqcol)
End If
Next
Next
oxl.Quit
Set ows=Nothing
Set owb=Nothing
Set oxl=Nothing
End Function
Function fnsetval(objcontrol,strcolname)
reqval = fngetdata (strcolname)
objcontrol.set reqval
End Function-- -- 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.
Copy of DataSheet.xls
Description: MS-Excel spreadsheet
