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
How will you get the last occurrence of one string within another string using vbscript?
Explain vbscript in detail?
What is the purpose of folders object of scripting.filesystemobject class in vbscript?
Mention what is select case statement?
What is the purpose of on error resume next statement?
How are comments handled in the vbscript language?
Compare java script and vb script?
How to write VB script for login module?
why variable name should not exceed 255 characters?
What are the rules to name variable in vbscript?
what is the differance between BYVAL,BYREF?
wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......
What is the difference between a dictionary and an array?
Which object is used to work with the excel sheets in the vbscript language and what statement is used to create this object?
If else for do while select in vb script?