如何在HP QTP中通过其样式来识别HTML对象?
我有一个网络应用程序和两个具有相同类名(没有 ID)的对象,其他属性也相同。区别仅在于相同的样式属性:其中一个对象具有 "style.display='block'"
,其他对象具有 "style.display='none'"
。 (可能是其他样式属性!)
我如何通过它的样式属性来识别第一个对象?对于这样的名称,我可以使用“attribute/name”,但是样式有类似的东西吗?
谢谢你!
I have a web app and two objects with same class name (no IDs), other attributes also the same. The difference only in same style attributes: one of the objects has "style.display='block'"
, other has "style.display='none'"
. (could be other styles attributes!)
How I can identify first object by it's style attributes? For thing such names, I could use "attribute/name"
, but is there anything like this for style?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑:我最初的答案在当时是正确的,但 UFT 此后添加了对
style/
属性的支持。您现在可以使用style/display:=none"
。这确实是 QTP 中的一个限制 :(
您可以做的一件事是编写一个小型 WebExtesibility 项目来添加显示您的测试对象的属性。
Edit: My original answer was true for its time but UFT has since added support for
style/
properties. You can now usestyle/display:=none"
.This is indeed a limitation in QTP :(
One thing you can do is write a small WebExtesibility project which adds the display property to your test object.
我知道这是一个老问题,但它被接受,好像没有一个简单的解决方案,虽然有:
是的,你可以,但它必须是实际对象的属性,并且不被父对象继承(好吧,我在这种情况下得到了负面结果)。
I know this is an old question, but it is accepted as if there is not a simple solution for it, while there is:
Yes you can, but it has to be an attribute on the actual object and not inherited by parent objects (well, I had negative results on that situation).