This example will illustrate how to use programmatic descriptions to interact with a web page, www.QTPHelper.com to be more exact... Note that I've used a simple regular expression in the Browser and Page description, just in case the titles change in the future.
Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").Link("Text:=Home").Click
' check that the user isn't already logged in
If Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").WebButton("Name:=Logout").Exist(1) Then
' click logout
Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").WebButton("Name:=Logout").Click
End If ' user logged in
' set the username
Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").WebEdit("Name:=username").Set "User"
' set the password
Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").WebEdit("Name:=passwd").Set "Password"
' tick the remember-me tickbox
Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").WebCheckBox("Name:=remember").Set "ON"
Wednesday, 19 October 2011
QTP Script: Using Programmatic Descriptions to interact with a web page
21:13
No comments
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment