QTP中是否可以有反描述?
我有一个美元金额表,其中一些是链接。示例:
$0.00
1,000.00 美元
$1.00
在 QTP-land 中我该如何最简洁地说?
Set desCurrencyString = Description.Create
desCurrencyString("micclass").value = NOT "Link"
我想我可以使用布尔值来查看链接在哪里,并以某种方式捕获列表的其他部分,可能如下所示:
Set desCurrencyString = Description.Create
desCurrencyString("text").RegularExpression = True
desCurrencyString("text").value = "\$[0-9]*"
Set arrCurrencyStrings = Page.ChildObjects(desCurrencyString)
desCurrencyString("micclass").value = "Link"
arrCurrencyStrings.Remove(desCurrencyString) 'Or something, will be editing this line later
What I have is a table of dollar amounts, some of which are links. Example:
$0.00
$1,000.00
$1.00
How do I say this most succinctly in QTP-land?
Set desCurrencyString = Description.Create
desCurrencyString("micclass").value = NOT "Link"
I suppose I could just use a boolean value to see where the link is and somehow capture the other parts of the list, possibly like this:
Set desCurrencyString = Description.Create
desCurrencyString("text").RegularExpression = True
desCurrencyString("text").value = "\$[0-9]*"
Set arrCurrencyStrings = Page.ChildObjects(desCurrencyString)
desCurrencyString("micclass").value = "Link"
arrCurrencyStrings.Remove(desCurrencyString) 'Or something, will be editing this line later
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需循环浏览 WebTable。
要获取单元格文本,请使用 WebTable 对象的 GetCellData(Row, Col) 方法。
要获取单元格中包含的子对象,请使用 WebTable 对象的 ChildItem(Row, Col, MicClass, intIndex) 方法。
ChildObjects 函数不能返回表格行、单元格、跨度、div 等,因为它们不是真正的 GUI 对象类。 (不过,如果您非常需要它,您可以定义此类自定义对象,但您必须在对象存储库管理器中手动设置它们)。
Simply loop through a WebTable.
To get cell text, use GetCellData(Row, Col) method of WebTable object.
To get a child object contained in a cell, use ChildItem(Row, Col, MicClass, intIndex) method of WebTable object.
Neither table rows, nor cells, spans, divs, etc. can be returned by ChildObjects function as they are not truly GUI object classes. (Though, if you would need it very much you could define such custom objects, but you'd have to manually set them up in Object Repository Manager).