can any body give the code to write the function for given
suppose user login with usrer id and pwd to yahoomail.after
cliking "sign in"if it is valid user id the next page will
display userid'message box.( Note u have to use excel sheet
to retrive the userid's data)
Answer Posted / badri
'Create an excel sheet with username and password
'Get username and password from the excel sheet
Set excelobj=createobject("excel.application")
excelobj.workbooks.open("C:\Documents and
Settings\12Desktop\test data.xls")
usrname=excelobj.sheets(1).cells(2,1)
pwd=excelobj.sheets(1).cells(2,2)
excelobj.workbooks.close
' add the objects to the Object Repository
'Function for username
Function username
If Browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The
best").WebEdit("login").Exist Then
If Browser("Yahoo! Mail: The best").Page("Yahoo!
Mail: The best").WebEdit("login").GetROProperty("disabled")
=false Then
Browser("Yahoo! Mail: The best").Page
("Yahoo! Mail: The best").WebEdit("login").Set usrname
reporter.ReportEvent
micpass,"WebEdit","UsernameEntered: "&usrname
End If
else
reporter.ReportEvent
micfail,"WebEdit","Username Not Entered"
End If
End Function
'Calling the username function
username
'Function for password
Function password
If Browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The
best").WebEdit("passwd").Exist Then
If Browser("Yahoo! Mail: The best").Page("Yahoo!
Mail: The best").WebEdit("passwd").GetROProperty("disabled")
=false then
Browser("Yahoo! Mail: The best").Page
("Yahoo! Mail: The best").WebEdit("passwd").Set pwd
reporter.ReportEvent
micpass,"WebEdit","Password Entered: "&pwd
End If
else
reporter.ReportEvent
micfail,"WebEdit","Password Not Entered"
End If
End Function
'calling the password function
password
'checking the username is valid or not
username="bhadrudu_p"
getdata=Browser("Yahoo! Mail: The best").Page("(1 unread)
Yahoo! Mail").WebElement("bhadrudu_p").GetROProperty
("innertext")
Function usrvalid
If trim(getdata)=trim(username) Then
reporter.ReportEvent micpass,"WebElement","Valid
user"
else
reporter.ReportEvent micfail,"WebElement","Welcome
page not present"
End If
End Function
usrvalid
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain the operator precedence in vb script?
Is VB Script Case sensitive or Case insensitive?
Explain about .wsf files?
How can you create a file object to work with the files in the vbscript language?
Which date function is used in the vbscript language to find the difference between the 2 dates?
How do i automate a website www.flyashx.com without having any test cases witin a week time.
When does ‘on click of button’ event gets triggered in the vbscript language?
when we use filter funtiom invb script(QTP)
How do you declare a variable in vbscript?
Explain the support of asp for vb script functionality?
How to throw an error in vbscript?
How can constants be declared in the vbscript language?
How are values assigned to the variables in the vbscript language?
How to Import data from a file (file is on the desktop) to the data table
What is the difference between for loop and while loop?