runtime-error - .GetRoProperty 的 UFT/QTP 一般运行时错误
问题描述
您好,我收到一般的运行时错误。这与预加载的下拉菜单一起使用,在此之前我还有另一个功能可以正常工作。但是当它尝试运行它时,我得到了错误。
我尝试过使用不同的属性,如内文、html id 等。但这会得到相同的错误。
Sub WebList(DropDown)
Set myPage=Browser("title:=.*").Page("title:=.*")
Set myWebList=Description.Create()
myWebList("micClass").value="WebList"
Set AllWebList=myPage.ChildObjects(myWebList)
totalWebList=AllWebList.count()
For i = 0 To totalWebList
If AllWebList(i).GetRoProperty("name") = DropDown Then
AllWebList(i).select ("GO")
wait(3)
Exit for
End If
Next
Set myPage = nothing
Set myWebList2 = Nothing
Set AllWebList2 = nothing
End Sub
我希望选择下拉列表。感谢您的任何帮助/建议。此外,如果我可以改进任何线路以使其成为动态且经验丰富的编码器,请建议他们。
解决方案
您的For
循环中有一个错误,如果没有具有指定名称的列表,您将访问比实际存在的列表多一个。这是因为To
在 vbscript 中是包容性的,并且索引从0
. 如果找到该列表,则该代码对我有用。
For
循环应该是:
For i = 0 to totatlWebList - 1
推荐阅读
- eclipse - 保存文件时 Eclipse 上的异常行为
- jquery - 从数据库中选择第三级
- ngrx - 状态不应该是不可变的吗?
- python - ValueError:您正在尝试将包含 14 层的权重文件加载到具有 3 层的模型中
- opengl - GLSL 扩展在应该可用时不可用
- angular - 如何在角度 2 中的 @Component 中使用样式中的变量?如何在样式中使用名为 leftposition 的变量?
- nhibernate - NHibernate 和新创建的记录锁定
- javascript - Lodash 的“无”属性和输入数组
- angular - 在 Angular 中创建虚拟模型
- reactjs - 如何使用 jsdoc 记录 javascript 单元测试文件?