QTP的3类顺序标识-自动化测试
更新时间:2022-05-20 09:30:55 作者:多测师 浏览:259
总共有3类这样的顺序标识(Ordinal Identifiers):Location, Index 和 CreationTime
其中CreationTime仅适用于Browser对象。
顺序标识(Ordinal Identifiers)通常在描述性编程时使用。
例1:location(location顺序标识是用上到下进行的)
'Text Box 1
Browser("title:=.*Descriptive.*").Page("micclass:=Page").WebEdit("name:=dpTest","location:=0").Set "1"
'Text Box 3
Browser("title:=.*Descriptive.*").Page("micclass:=Page").WebEdit("name:=dpTest","location:=1").Set "2"
'Text Box 2
Browser("title:=.*Descriptive.*").Page("micclass:=Page").WebEdit("name:=dpTest","location:=2").Set "3"
'Text Box 4
Browser("title:=.*Descriptive.*").Page("micclass:=Page").WebEdit("name:=dpTest","location:=3").Set "4"
例2:index(index顺序标识是从左到右进行的)
'Text Box 1
Browser("title:=.*Descriptive.*").Page("micclass:=Page").WebEdit("name:=dpTest", "index:=0").Set "1"
'Text Box 2
Browser("title:=.*Descriptive.*").Page("micclass:=Page").WebEdit("name:=dpTest", "index:=1").Set "2"
'Text Box 3
Browser("title:=.*Descriptive.*").Page("micclass:=Page").WebEdit("name:=dpTest", "index:=2").Set "3"
'Text Box 4
Browser("title:=.*Descriptive.*").Page("micclass:=Page").WebEdit("name:=dpTest", "index:=3").Set "4"
例3:CreationTime(仅对浏览器对象生效,按对象产生时间先后顺序排列)
SystemUtil.Run "iexplore.exe", "http://www.1.com" 'CreationTime 0
SystemUtil.Run "iexplore.exe", "http://www.2.com" 'CreationTime 1
SystemUtil.Run "iexplore.exe", "http://www.3.com" 'CreationTime 2
Browser( "creationtime:=" ).Highlight 'Highlight 1.com
Browser( "creationtime:=1" ).Highlight 'Highlight 1.com
Browser( "creationtime:=2" ).Highlight 'Highlight 3.com
以上内容为大家介绍了自动化测试中的QTP的3类顺序标识,本文由多测师亲自撰写,希望对大家有所帮助。了解更多自动化测试相关知识:https://www.aichudan.com/xwzx/
上一篇:QTP自动化测试Google地图