TestComplete中使用VBScript脚本实现对容器控件中子对象的遍历
2014-10-31 15:39
375 查看
1、需求:实现在某个容器控件中只选择某一个指定的值
2、抓取目标容器:namemapping后赋值
Set DetailProdGroups=Aliases.dbcProductsDetailContainer.DetailProdGroup
容器布局如下(每一行有checkbox,image,textview,label等):
3、实现思路:只抓取到容器这一层即可,然后根据child方法或者item方法(控件不同方法不一样)获取子对象,再在循环中匹配子对象的名称即可实现。
4、代码贴上:
2、抓取目标容器:namemapping后赋值
Set DetailProdGroups=Aliases.dbcProductsDetailContainer.DetailProdGroup
容器布局如下(每一行有checkbox,image,textview,label等):
3、实现思路:只抓取到容器这一层即可,然后根据child方法或者item方法(控件不同方法不一样)获取子对象,再在循环中匹配子对象的名称即可实现。
4、代码贴上:
For i =0 To DetailProdGroups.BandCount-1 'get the name of child controls strProductName=DetailProdGroups.Child(i).ComponentTitle 'set the status of checked all false DetailProdGroups.Child(i).BandCheckbox.Checked=false If productname <>"" Then 'only select product "productname" If Instr(strProductName,productname)>0 Then DetailProdGroups.Child(i).BandCheckbox.Checked=true End If Else Log.Error("The product name"& productname &" is invalid.") Exit Sub End If Next
相关文章推荐
- [WinForm] 使用反射将业务对象绑定到窗体或控件容器
- 使用脚本自动创建AD中的层次化结构容器及对象
- 使用HashSet方法实现多个对象的遍历
- iOS_使用UIBezierPath对象实现视图控件的立体阴影效果和半透明背景效果
- WinForm中使用反射将业务对象绑定到窗体或控件容器
- 使用反映实现前端WEB窗口控件与后台数据库类对象的动态绑定
- 实现了IEnumerable接口的GetEnumerator 即可使用 Foreach遍历,返回一个IEnumerator对象
- 使用反映实现前端WEB窗口控件与后台数据库类对象的动态绑定
- WinForm中使用反射将业务对象绑定到窗体或控件容器
- 使用reverse_iterator迭代器实现STL容器的反向遍历
- javascript客户端遍历控件与获取父容器对象示例代码
- 使用遍历的方法实现对对象的深拷贝
- WinFrom遍历窗体中的控件以及使用DevExpress容器中的控件
- 使用脚本自动创建AD中的层次化结构容器及对象 推荐
- javascript客户端遍历控件与获取父容器对象示例代码
- 使用Tcl脚本调用STC平台的Native API实现测试对象、Device、StreamBlock的创建和配置
- 用jquery实现cookie的操作以及创建js数组和遍历js数组,js对象,jquery.json的使用
- WinForm中使用反射将业务对象绑定到窗体或控件容器
- 使用递归遍历对象获得value值的实现方法
- javascript客户端遍历控件和怎么获取父容器对象