VBS脚本求助
With Browser("Creationtime:=0").Page("Index:=0")If .WebElement("Html id:=LoginView1_lblInfo").GetROProperty ("outertext")=datatable ("提示信息","登陆测试") then
Reporter.ReportEvent micPass,"用户登陆测试","测试成功"
DataTable.Value("测试结果","登陆测试")="Pass"
Else
Reporter.ReportEvent micFail,"用户登陆测试","测试失败"
DataTable.Value("测试结果","登陆测试")="Fail"
End If
ExportSheet "平台测试结果.xls","登陆测试"
End With
请高手指教:
以上是实际使用环境,如果只是上面环境我可以写成sub,但是我其实需要的目标是if 条件为真(这样可以应用各种场景)时则进行文件导出,不知道if那块如何写,才能满足我应用到各种场景中。
If 条件=true then
Reporter.ReportEvent micPass,"用户登陆测试","测试成功"
DataTable.Value("测试结果","登陆测试")="Pass"
Else
Reporter.ReportEvent micFail,"用户登陆测试","测试失败"
DataTable.Value("测试结果","登陆测试")="Fail"
End If
ExportSheet "平台测试结果.xls","登陆测试" 回复 1# peagus
dim result
With Browser("Creationtime:=0").Page("Index:=0")
result= .WebElement("Html id:=LoginView1_lblInfo").GetROProperty ("outertext")=datatable ("提示信息","登陆测试")
end with
sub logInJudge(result)
if result then
'your code
end if
end sub 非常感谢。
页:
[1]