QTP中是否可以有反描述?

发布于 2024-09-11 20:40:26 字数 696 浏览 2 评论 0原文

我有一个美元金额表,其中一些是链接。示例:

$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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心凉 2024-09-18 20:40:26

只需循环浏览 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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文