---
title: "解决 QTP General Run Error for webElement GetROProperty"
author: "jerome_wang"
date: "2012-12-25T10:34:01Z"
tags: []
categories: ["行业应用"]
slug: "qtp-general-run-error-for-webelement-getroproperty"
draft: false
lastmod: "2012-12-25T10:34:01Z"
id: 1753655
url: "https://jerome-wang.iteye.com/blog/1753655"
---

现象: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