QTP-获取元素的值
我从 QTP 开始,只是不知道如何获取元素的值。例如,当我只想比较谷歌找到的结果数量时。我尝试使用对象间谍选择元素并使用 Val(Element) 将值分配给变量..但它不起作用。有人可以帮忙解决这个问题吗?顺便说一句,我不确定选择与对象间谍进行比较的文本(元素)是否正确。 谢谢!
I am beginning with QTP and just cannot find out how to get value of element. For example when I just want to compare the number of results found by google. I tried to select the element with object spy and use Val(Element) to assign the value into variable..but it doesnt work. Could anyone help with this? BTW, I am not sure whether selecting the text (element) to compare with Object spy is correct.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 GetROProperty 来获取文本,然后解析它以获取值。
查看 Google 结果页面,我发现结果位于第三个粗体标记中带有
id=resultStats
的段落中。因此,以下脚本获取数字(作为带逗号的字符串)。
You should use
GetROProperty
in order to get the text and then parse it for the value.Looking at a Google results page I see that the result is in a paragraph with
id=resultStats
in the 3rd bold tag.So the following script gets the number (as a string with commas).