《精通QTP-自动化测试技术领航》学习笔记4-weblist&webradiogroup

代码:

'前提:进入51论坛-个人中心,点击“论坛个性化设定”
With browser("51Testing软件测试论坛 软件测试 -").Page("51Testing软件测试论坛 软件测试 -")
'step1--校验选择界面风格
    DataTable.Value("界面风格","weblist&webradiogroup")="discuz6"
    tvalue1=datatable.Value("界面风格","weblist&webradiogroup")
    .WebList("界面风格").Select tvalue1
    actvalue1=trim(.WebList("界面风格").GetROProperty("selection"))
    DataTable.Value("界面风格","weblist&webradiogroup")="使用默认"
    tvalue2=datatable.Value("界面风格","weblist&webradiogroup")
    .WebList("界面风格").Select tvalue2
    actvalue2=trim(.WebList("界面风格").GetROProperty("selection"))
    If actvalue1=tvalue1 and actvalue2=tvalue2 Then
        reporter.ReportEvent micPass ,"step1","passed"
    else
        reporter.ReportEvent micPass ,"step2","failed"
    End If
End With

With browser("51Testing软件测试论坛 软件测试 -_2").Page("51Testing软件测试论坛 软件测试 -")
'step2--选择其他选项,这里不做校验
        .WebRadioGroup("每页主题数").Select "30"
        .WebRadioGroup("每页帖数").Select "15"
        .WebRadioGroup("签名显示设置" ).Select "1"
        .WebRadioGroup("头像显示设置" ).Select "2"
        reporter.ReportEvent micDone ,"step2 doesn't checked",""
 'step3--校验时差设定选择某个特定值,及随机选择某个值     
        expect="(GMT -10:00) Hawaii" '对应的index值是3
        .WebList("时差设定").Object.selectedIndex = "3"
        actual=trim(.WebList("时差设定").GetROProperty("selection"))
        If actual = expect Then
            reporter.ReportEvent micPass ,"step3","passed"
        else
            reporter.ReportEvent micFail  ,"step3","failed"
        End If
        '获取list下具体有几个选项
        itemcount=.WebList("时差设定").GetROProperty("items count")
        tvalue3=RandomNumber(0,itemcount-1)
        .WebList("时差设定").Object.selectedIndex = tvalue3
        reporter.ReportEvent micDone ,"随机选择的index:"&tvalue3&"",""
        
End With

知识点:

1.DataTable.Value("界面风格","weblist&webradiogroup")="discuz6":给”界面风格“列赋值,注意第二个参数也需要双引号括起来

2.调用封装属性items count的属性值从而获取weblist下具体有几个选项

3.RandomNumber(x,y):随机获取x到y之间的一个值

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值