我正在尝试检查一个值是否包含在网络元素的内部文本中,但我遇到了一个小问题:框架似乎在每次刷新页面时都会发生变化。
这些是我记录的步骤:
Browser("SystemPage").Page("SystemP").Frame("dme2_header").Image("Gestione Anagrafiche").Click<br>
Browser("SystemPage").Page("SystemP").Frame("dme2_appl").WebEdit("pdrBean.pdrPod").Set parameter("POD")<br>
Browser("SystemPage").Page("SystemP").Frame("dme2_appl").WebButton("Cerca").Click
Browser("SystemPage").Page("SystemP").Frame("dme2_appl_2").Image("show_files").Click
Browser("SystemPage").Page("SystemP").Frame("dme2_appl_6").Image("Lente").Click
cctype = Browser("SystemPage").Page("SystemP").Frame("dme2_appl_7").WebElement("arrow_down").GetROProperty("innertext")<br>
DataAct = Browser("SystemPage").Page("SystemP").Frame("dme2_appl_7").WebElement("arrow_down_2").GetROProperty("innertext")<br>
Browser("SystemPage").Page("SystemP").Frame("dme2_header").Image("Gestione Anagrafiche").Click
帧“dme2_appl6”和“dme2_appl7”在这两个页面的每次刷新时都会发生变化。
问题很简单:如何重写这两个 Action ,使它们通用?
我试过做类似的事情:
Set objFrame = Frame("title:=dme2_appl_.")
然后
Browser("SystemPage").Page("SystemP").objFrame.Image("Lente").Click
但是 QTP 返回错误:“对象不支持的属性或方法”
最佳答案
请尝试使用下面的代码
Browser("SystemPage").Page("SystemP").Image("Lente").Click
避免使用“Frame”,如果您真的想使用它,请将正则表达式放在 Frame 的名称属性中。
转到对象属性--> 单击框架对象--> 强制属性--> 将名称属性更改为 像 iFrame_213123123 到 i.*
希望这能解决您的问题。
关于testing - QTP - 检查动态页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28721255/