我正在自动化具有状态栏的应用程序,如果完成某些事情,它会向前移动(变为绿色)。现在,我想检查一下,当我完成任务时,它变为绿色。 QTP的Object间谍没有显示Color属性,只是编写getroproperty(“color”)也不行。所以我试图在QTP中使用CSS来实现它。以下是我的代码 -
set a = Browser("name:.*").page("title:=.*")
'here it highlights the correct part of the status bar
a.Webelement("css:=.progress-bar-success").Highlight
color = a.Webelement("css:=.progress-bar-success").GetROProperty ("background color")
msgbox color
'but the above msgbox returns a blank value
'if i replace the 3 rd line with the following
color = a.Webelement("css:=.progress-bar-success").GetROProperty ("style/background color")
然后它返回一个恒定的rgb值(92,184,92),即使对于没有进展的其他记录也是如此。有什么建议吗?
答案 0 :(得分:1)
如果您正在访问Webelement,请尝试以下行,它应该有效:
a.Webelement("css:=.progress-bar-success").Object.style.backgroundColor