51Testing软件测试论坛

标题: QTP的select方法使用出错 [打印本页]

作者: zcf616    时间: 2010-8-14 18:25
标题: QTP的select方法使用出错
今天用脚本打开一个下拉框控件,里面含多个item,用了select方法选择,可是执行完了报错。这个方法好像是选择什么special item什么的,不知是什么意思,不知道怎么解决,有其他的办法啊?谢谢
作者: TIB    时间: 2010-8-14 18:56
要看具体是什么控件,什么开发语言、是否是第三方控件或自定义控件,最好贴出代码来,这样才好分析解决
作者: zcf616    时间: 2010-8-15 10:18
谢谢,问题是这样的:我在脚本里用了个循环语句去点击下拉控件的每个选项,用了个变量i表示选项的index,后来就用了browser('..').weblist("select").select(i)语句,执行后弹出Cannot identify the specified item of the select object. Confirm that the specified item is included in the object's item collection’的提示,但是i换成具体的1,2,3。。。。后就没这个问题,是不是值是变量的关系,select方法究竟怎么用呢?请指教,谢谢了
作者: kavensyw    时间: 2010-8-15 22:53
首先跟踪下i有没有出界,如果没出界也不对,要加#看看呢?
试试:browser('..').weblist("select").select "#"&i

[ 本帖最后由 kavensyw 于 2010-8-15 22:55 编辑 ]




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2