TA的每日心情 | 开心 2017-10-12 13:54 |
---|
签到天数: 3 天 连续签到: 1 天 [LV.2]测试排长
|
'SystemUtil.Run "http://bbs.51testing.com/forum-69-1.html"
Browser("【新提醒】[QuickTest Professional]").Page("【新提醒】[QuickTest Professional]").Image("发新帖").Click
Browser("【新提醒】[QuickTest Professional]").Page("【新提醒】[QuickTest Professional]").Link("高级模式").Click
With Browser("【新提醒】[QuickTest Professional]").Page("【新提醒】发表帖子 - [QuickTest")
.WebElement("附加选项").Click
'step 1------------------------------------------------------------------------------------------------------->
'在获取一些属性的时候往往会多返回一个空格字符串,所以,在此
'建议有这样的意识保持这样的习惯,多加Trim,它的作用是去空格
'通过自身属性获取htmlon checkBox控件的自身接口属性disabled,返回True或者False
disabled1=trim(.WebCheckBox("htmlon").Object.disabled)
'获取自身接口属性checked,返回True或False
check1 = trim(.WebCheckBox("htmlon").Object.checked)
'通过GetROProperty方法来获取htmlon checkBox控件的自身接口属性disabled,返回True或者False
disabled2 = trim(.WebCheckBox("WebCheckBox").GetROProperty("disabled"))
check2 = trim(.WebCheckBox("WebCheckBox").GetROProperty("checked"))
' msgbox disabled1
' msgbox check1
' msgbox disabled2
' msgbox check2
'check point start
'请注意业务逻辑
If disabled1="True" and disabled2="1" and check1="False" and check2="1" Then
Reporter.ReportEvent micPass,"step 1","通过"
else
Reporter.ReportEvent micFail,"step 1","失败"
End If
End With
'step 2---------------------------------------------------------------------------------------------->
'预先设置一个值以作后用
Dim vTrue,vFalse
vTrue = "True"
vFalse ="False"
'使用自身接口去修改值,即修改webCheckBox的属性
'在这里只要基于checked这个属性做文章就能做到选择或者不选择
'设置为False代表不选择webCheckBox,即使已选择也会被反选
With Browser("【新提醒】[QuickTest Professional]").Page("【新提醒】发表帖子 - [QuickTest")
.WebCheckBox("allownoticeauthor").Object.checked=vFalse
'获取自身接口属性checked用于验证,不再重复阐述
checkVal1 = trim(.WebCheckBox("allownoticeauthor").Object.checked)
.WebCheckBox("usesig").Set "OFF"
'获取自身接口属性checked用于验证,不再重复阐述
checkVal2 = trim(.WebCheckBox("usesig").Object.checked)
.WebCheckBox("WebCheckBox_2").Set "OFF"
'获取自身接口属性checked用于验证,不再重复阐述
checkVal3= trim(.WebCheckBox("WebCheckBox_2").Object.checked)
'check point start
' msgbox checkVal1 :msgbox checkVal2:msgbox checkVal3
If checkVal1=vFalse and checkVal2=vFalse and checkVal3 = vFalse Then
Reporter.ReportEvent micPass,"step 2","通过"
else
Reporter.ReportEvent micFail,"step 2","失败"
End If
'step 3--------------------------------------------------------------------------------------------->
'属性设置为True,代表选择WebCheckBox
.WebCheckBox("allownoticeauthor").Object.checked = vTrue
checkVal4= trim(.WebCheckBox("allownoticeauthor").Object.checked)
'在前面使用的参数是OFF代表反选,那么ON代表勾选,
'另外这里的参数是不区分大小写
.WebCheckBox("usesig").Set "on"
checkVal5 = trim(.WebCheckBox("usesig").Object.checked)
msgBox checkVal4:msgBox checkVal5
' check point start
If checkVal4= vTrue and checkVal5= vTrue Then
Reporter.ReportEvent micPass,"step 3","通过"
else
Reporter.ReportEvent micFail,"step 3","失败"
End If
End with
请问一下各位上面这段写的啥?有什么用?
|
|