Friday, May 9, 2014

QTP code to Send Sms using Way 2 SMS

option explicit
Dim x, n
'launch way2sms
systemutil.Run("www.way2sms.com")
'login
With browser ("title:=Free SMS.*")
With .page("title:=Free SMS.*")
.webedit("name:=username").set "Mobile Number"
.webedit("name:=password").set "Password"
.webbutton("name:=Login").click
End With
End With
'click send  FREE sms
With browser("title:=Free SMS.*")
With .page("title:=Free SMS.*")
.webelement("html tag:=DIV","index:=12").Click
End With
End With

'click send sms
With browser("title:=Free SMS.*")
With .page("title:=Free SMS.*")
.link("html tag:=A","index:=52").Click
End With
End With
'fill fields to send sms
With browser("title:=Free SMS.*")
With .page("title:=Free SMS.*")
.webedit("value:=Mobile Number").Set "Mobile Number "
.webedit("name:=textArea").Set "Message"
.webbutton("name:=Send SMS").Click
         End With
End With
'validating sms status
With browser ("title:=Free SMS.*")
With .page("title:=Free SMS.*")
With .frame ("name:=frame")
x=.webelement("html tag:=DIV","index:=9").GetROProperty("innertext")
If trim(x)="Message has been submitted successfully" Then
msgbox("Send SMS test passed")
Else
msgbox("send sms test failed")
End If
End With
End With
end with

No comments:

Post a Comment