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 to comvert 120 into one hunderd twenty rupees only and vice varsa
What is the event handling in vbscript?
How to scroll down a page while recording in qtp. suggest me any method apart from low level recording.
Capture the Unique label changes on google home page for I am feeling lucky button and save those label changes to Notepad Note: Using QTP
Explain the constants in vbscript?
Mention what is select case statement?
Why to use option explicit in vb script?
Why is it recommended to close the database connection every time after the work is completed?
What is sql loader? Explain the files used by sql loader to load file?
What's the difference between vbscript and vb.net?
Differentiate javascript and vbscript?
Write a code to print numbers from 5 to 0?
Why is the use of exit do or exit for statements within loops discouraged?
Mention characteristics of sub procedures?
If a calulator having 3 buttons (of any number)in 3 of them one is not working properly due to which answer is wrong always. write a script to find out which button is not working properly ?