if ehome.image("outerhtml:=<IMG src=(.)*+Images\/mood\/+"&DataTable("diary_xq", dtGlobalSheet)&".gif+(.)*").exist then
Reporter.ReportEvent micPass, "日记天气正确", "Pass"
Else
Reporter.ReportEvent micFail, "日记天气不正确", "Fail"
End If
(1)Set checkimage=description.create()
checkimage("outerhtml").value="\<IMG src=\"http:\/\/file.ehome.cn\/Images\/mood\/[1-6].gif\"、>"
checkimage("outerhtml").RegularExpression = True
(2)或者QTP帮助里面有这个函数,看是否能帮到你。
Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches ' Create variable.
Set regEx = New RegExp ' Create a regular expression.
regEx.Pattern = patrn ' Set pattern.
regEx.IgnoreCase = True ' Set case insensitivity.
regEx.Global = True ' Set global applicability.
Set Matches = regEx.Execute(strng) ' Execute search.
For Each Match in Matches ' Iterate Matches collection.
RetStr = RetStr & "Match found at position "
RetStr = RetStr & Match.FirstIndex & ". Match Value is '"
RetStr = RetStr & Match.Value & "'." & vbCRLF
Next
RegExpTest = RetStr
End Function
MsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))
set xq = Description.Create()
xq("outerhtml").Value = "http://file.ehome.cn/Images/mood/"&DataTable("diary_bq", dtGlobalSheet)&".gif"
xq("outerhtml").RegularExpression = False
objectname.image(xq).exist
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |