51Testing软件测试论坛

标题: 网页中按钮置灰问题 [打印本页]

作者: loveyou99    时间: 2009-8-14 15:50
标题: 网页中按钮置灰问题
现要测试一个网站,页面中有两个按钮,A和B按钮。情况是这样的:按下A按钮时,显示A页面,同时A按钮置灰,B按钮是处在可点击的状态。按下B按钮时,显示B页面,同时B按钮置灰,A按钮是处在可点击的状态。
录制点击A、B按钮显示
Browser("welcome").Page("front").Frame("main").WebButton("A").Click
Browser("welcome").Page("front").Frame("main").WebButton("B").Click

我要在qtp脚本中写一个脚本,如B按钮置灰就点击A按钮,怎么写?
作者: loveyou99    时间: 2009-8-14 16:18
我写成这样的判断,

if (Browser("welcome").Page("front").Frame("main").WebButton("A").visable= true ) then
Browser("welcome").Page("front").Frame("main").WebButton("A").Click
end if

这里面写成visable=true, 但是不行, 不知道要用什么,请 高手指点。
作者: leeyongbo    时间: 2009-8-14 16:28
Browser("welcome").Page("front").Frame("main").WebButton("B").Click
hi=Browser("welcome").Page("front").Frame("main").WebButton("B").getroproperty ("visable")

if hi=true then
Browser("welcome").Page("front").Frame("main").WebButton("A").Click
end if
作者: hugh007    时间: 2009-8-14 17:18
原帖由 leeyongbo 于 2009-8-14 16:28 发表
Browser("welcome").Page("front").Frame("main").WebButton("B").Click
hi=Browser("welcome").Page("front").Frame("main").WebButton("B").getroproperty ("visable")

if hi=true then
Browser("welcome").P ...




作者: supermichael    时间: 2009-8-14 17:23
要么是visible这个属性不对?
作者: dabie    时间: 2009-8-14 17:32
visiable是是否可见属性,按钮灰了就看不见了吗?
灰了是按钮处于不可用状态,应该是enable属性
作者: supermichael    时间: 2009-8-14 17:59
楼上说的有理
作者: dingxianzhi    时间: 2009-8-15 07:38
哈哈哈!

[ 本帖最后由 dingxianzhi 于 2009-8-17 10:06 编辑 ]
作者: loveyou99    时间: 2009-8-17 10:03
现使用语句,完成任务。

hi=Browser("welcome").Page("front").Frame("main").WebButton("B").getroproperty ("disabled")

if hi =1  then
Browser("welcome").Page("front").Frame("main").WebButton("A").Click

end if

谢谢大家的帮助!




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