51Testing软件测试论坛

标题: qtp 中2个webelement属性值是联动的,第二个webelement属性值怎么获取 [打印本页]

作者: jialingling7777    时间: 2016-11-21 11:06
标题: qtp 中2个webelement属性值是联动的,第二个webelement属性值怎么获取
本帖最后由 jialingling7777 于 2016-11-21 11:15 编辑

Set gradeoDesc=description.Create()
gradeoDesc("micclass").value="WebElement"
gradeoDesc("html tag").value="LI"

set gradeobj=browser("问学学校管理平台").Page("问学学校管理平台_3").WebElement("高中二年级高中三年级初中二年级初中三年级小学二年级小学六年级").ChildObjects(gradeoDesc)
gradetotal=gradeobj.count
msgbox gradetotal
graderand=randomnumber(1,gradetotal)
gradeobj(graderand).Click
'Browser("问学学校管理平台").Page("问学学校管理平台_3").WebElement("初中二年级").Click


wait  2



Set classoDesc=description.Create()
classoDesc("micclass").value="WebElement"
classoDesc("html tag").value="SPAN"
set classobj=browser("问学学校管理平台").Page("问学学校管理平台_3").WebElement("初中二年级 ( 1 ) 班 初中二年级 (").ChildObjects(classoDesc)
classtotal=classobj.count
msgbox classtotal
classrand=randomnumber(1,classtotal)
classobj(classrand).Click

上面的代码是实现先随机选年级再随机选班级,但是由于班级是根据选的年级出来的classobj=browser("问学学校管理平台").Page("问学学校管理平台_3").WebElement("初中二年级 ( 1 ) 班 初中二年级 (").ChildObjects(classoDesc)中的WebElement("初中二年级 ( 1 ) 班 初中二年级 (")属性值根据年级的变化它的属性值(班级)是变化的导致回放时出问题,怎么处理啊这类
页面见图
作者: jialingling7777    时间: 2016-11-21 11:10
我现在年级是可以做到随机切换了,但是班级怎么都做不到切换并点击,因为点击班级会展开班级中的人员




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