Public Function login(Url,UserName,Password)
Browser("title:=about:blank").Page("url:=[a-z].*").Sync
Browser("title:=about:blank").Navigate urlBrowser("title:=Login").Page("title:=Login").Sync
If not Browser("title:=Login").Page("title:=Login").Exist(TIMEOUT) Then
report_result "FAIL","Login","Login Page is not Displayed" login = -1
Exit Function
End If
Browser("title:=Login").Page("title:=Login").WebEdit("outerhtml :=.*username.*","name:=username").Set username
Browser("title:=Login").Page("title:=Login").WebEdit("outerhtml := .*password.*", "name:=password").Set password
If Browser("title:=Login").Page("title:=Login").Image("alt:=.*Login.*").Exist(OBJ_TIMEOUT) Then
Browser("title:=Login").Page("title:=Login").Image("alt:=.*Login.*").Click
Else
Browser("title:=Login").Page("title:=Login").WebButton("name:=.*Login.*").Click
End If
Browser("title:=Test.*").Page("title:=Test.*").Sync
If Browser("title:=Test.*").Page("title:=Test.*").Exist(TIMEOUT) Then
report_result "PASS","Login","Login Is Successful with the user : "+ username login = 0
Else
report_result "FAIL","Login","Login Is UnSuccessful with the user : "+ username + " User details may not be right. look at the Global data Table" login = -1
Exit Function
End If
End Function
No comments:
Post a Comment