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


Please Help Members By Posting Answers For Below Questions

Explain the operator precedence in vb script?

738


Is VB Script Case sensitive or Case insensitive?

734


Explain about .wsf files?

711


How can you create a file object to work with the files in the vbscript language?

592


Which date function is used in the vbscript language to find the difference between the 2 dates?

697






How do i automate a website www.flyashx.com without having any test cases witin a week time.

1542


When does ‘on click of button’ event gets triggered in the vbscript language?

638


when we use filter funtiom invb script(QTP)

2381


How do you declare a variable in vbscript?

718


Explain the support of asp for vb script functionality?

716


How to throw an error in vbscript?

697


How can constants be declared in the vbscript language?

646


How are values assigned to the variables in the vbscript language?

660


How to Import data from a file (file is on the desktop) to the data table

1673


What is the difference between for loop and while loop?

653