发布新日志

  • 选取webList中某一项

    2007-03-12 15:31:14

    groupCodeLenth= Browser("test").Page("test").Frame("mainFrame").WebList("mainFrame").Object.length
    Randomize
    groupCodeNum=int(groupCodeLenth*Rnd)
    msgBox"groupCodeNum= "&groupCodeNum
    if(groupCodeNum>=0) then
    Browser("test").Page("test").Frame("mainFrame").WebList("sgrouptitlecode").Select  "#" & groupCodeNum
    end if
  • ChildObjects和webTable的使用

    2007-03-12 12:37:39

    dim  maxCodeRow,maxCode,temp,webTableIndex
    Dim obj
    maxCode=0
    Set ōDesc = Descrīption.Create()
    oDesc("micclass").Value = "WebTable"

    '获得Browser("test").Page("test").Frame("mainFrame")下所有webTable
    Set Lists =Browser("test").Page("test").Frame("mainFrame").ChildObjects(oDesc)

    '获得webTable的总数
    NumberOfLists = Lists.Count()

    '对text ="XXX"的webTable进行操作
    For listIndex = 0 To NumberOfLists - 1
     Set ōbj=Lists(listIndex)
     text=obj.GetCellData(1,1)
     if( text ="XXX") then
       num=obj.RowCount'获得这个webTable的行数
       For  webTableIndex=2 to num'找出自己想要操作的行号,在这里取得编码为最大的行号
        temp=obj.GetCellData(webTableIndex,1)
        if( temp > maxCode  ) then
        maxCode=temp
        maxCodeRow=webTableIndex
        end if
       Next
       obj.childItem(maxCodeRow,9,"Link",0).Click'点击该行的“删除”连接
       Browser("test").Dialog("Microsoft Internet Explorer").WinButton("确定").Click
       exit for
     end if
    Next

  • (转载)QTP中虚拟对象设置

    2007-03-05 16:42:13

  • 登陆脚本设计

    2006-12-11 14:33:29

    这几天正在学习qtp,下面是我写的一个登陆脚本,若有什么不足之处,请大家指出

    Dim str,MyArray ,Msg

    Browser("test").Page("test").Frame("topFrame").WebEdit("name").Set DataTable("Name", dtGlobalSheet)
    Browser("test").Page("test").Frame("topFrame").WebEdit("name").Set DataTable("pwd", dtGlobalSheet)
    Browser("test").Page("test").Frame("topFrame").Link("登录").Click

    if(Browser("test").Dialog("Microsoft Internet Explorer").Exist) then
       str = Browser("test").Dialog("Microsoft Internet Explorer").GetVisibleText
      '假设系统提示信息为“请输入帐号!”,则“GetVisibleText ”这个函数返回的值是:
      'Microsoft  Internet  Explorer
      '请输入帐号!
      '确定
       MyArray = Split(str,  vbcrlf , -1, 1)
       'MyArray(0) =Microsoft  Internet  Explorer
       'MyArray(1) =请输入帐号!
       'MyArray(2) =确定
      str = MyArray(1)
      datatable.Value("result",dtGlobalSheet)=str
       Browser("test").Dialog("Microsoft Internet Explorer").WinButton("确定").Click
    Else
       Browser("test").Page("test").Frame("topFrame_2").Link("退出").Click
    end if

数据统计

  • 访问量: 7055
  • 日志数: 9
  • 建立时间: 2006-12-05
  • 更新时间: 2007-05-11

RSS订阅

Open Toolbar