解决 QTP General Run Error for webElement GetROProperty

现象:QTP 中 遍历对象为 welement对象是 会出现 General Run error

原因:WebElement catches all sorts of things and some may cause the General run error (still a bug with the tool).

 

解决方案:

Set wElement=Description.Create()
wElement("micclass").Value="WebElement"
wElement("html tag").Value="DIV" '根据实际情况添加 

Set cElements=Browser(myBrowser).Page(myPage).ChildObjects(wElement)
ElementsCount=cElements.count()
For i=0 to ElementsCount-1
msgbox cElements(i).GetROProperty("innertext")
If cElements(i).GetROProperty("innertext") = elementName Then
myY = cElements(i).GetROProperty("y")
Exit for
End If
Next

你可能感兴趣的:(property)