|
还是我抛块砖吧。基本想法是验证父节点的innertext,这样能将每个节点的值已经顺序保留下来做验证。代码如下:
treeText = Browser("GXT Context Menu Tree").Page("GXT Context Menu Tree").WebElement("class:=my-root-item").Object.innertext
actualTreeArray = Split(treeText, VBCRLF & VBCRLF)
expectedTreeArray = Array("Beethoven", "Quartets", "Six String Quartets", "Three String Quartets", "Grosse Fugue for String Quartets", "Add Child 1", "Sonatas", "Concertos", "Symphonies", "Brahms", "Mozart")
For i = 0 to UBound(actualTreeArray)
actualTreeArray(i) = Trim(actualTreeArray(i))
Next
If StrComp(Join(actualTreeArray), Join(expectedTreeArray)) = 0 Then
Reporter.ReportEvent micPass, "插入节点", "PASS"
Else
Reporter.ReportEvent micFail, "插入节点", "expected: " & Join(expectedTreeArray) & " VS " & "actual: " & Join(actualTreeArray)
End If
当然这种方式也是有缺陷的。 |
|