用QTP测试新浪微博的评论功能

来源:互联网 发布:淘宝客鹊桥计划好不好 编辑:程序博客网 时间:2024/05/16 00:30

测试新浪微博的评论功能,任意选取一条微博,发表评论,需要用到描述性语言,还有QTP中的正则表达式



systemutil.Run "C:\Program Files\Internet Explorer\iexplore.exe", "http://weibo.com/"


'输入账号和密码登录微博。
Browser("微博-随时随地分享身边的新鲜事儿").Page("微博-随时随地分享身边的新鲜事儿").WebEdit("username").Set DataTable("TD_userName", dtGlobalSheet)
Browser("微博-随时随地分享身边的新鲜事儿").Page("微博-随时随地分享身边的新鲜事儿").WebEdit("password").SetSecure DataTable("DT_password", dtGlobalSheet)
Browser("微博-随时随地分享身边的新鲜事儿").Page("微博-随时随地分享身边的新鲜事儿").Link("登录").Click
 
 
'任意选取一条微博,发表评论。
Set linkPP = Description.Create
linkPP = ("html tag").value = "A" 
linkPP = ("text").value = "评论.*"
set Links = Browser("name:=我的首页 微博-随时随地分享身边的新鲜事儿").page("title:=我的首页 微博-随时随地分享身边的新鲜事儿").ChildObjects(linkPP)


For i=0 to Links.count-1
   if Links(i).GetROProperty("url") = "javascript:void(0);"Then
  'print "链接text:"& Links(i).GetROProperty("text") &"    链接url:" & Links(i).GetROProperty("url")&"    链接name:" & Links(i).GetROProperty("name")
  Links(i).Click
   Exit for
  End If
 'print "不是评论的对象" 
Next


Browser("微博-随时随地分享身边的新鲜事儿").Page("我的首页 微博-随时随地分享身边的新鲜事儿").WebEdit("WebEdit").Set DataTable("D_pinLun", dtGlobalSheet)
Browser("微博-随时随地分享身边的新鲜事儿").Page("我的首页 微博-随时随地分享身边的新鲜事儿").Link("评论").Click
0 0
原创粉丝点击