QTP ChildObjects的妙用

SystemUtil.Run "www.baidu.com"
Set oDesc = Description.Create() /*创建线性编程对象*/ 
Browser("百度一下,你就知道").Page("百度一下,你就知道").Link("Link")
oDesc("micClass").Value = "Link" /*描述一个Link对象*/
Set Lists = Browser("百度一下,你就知道").Page("百度一下,你就知道").ChildObjects(oDesc)
NumberOfLists = Lists.Count() /*获取当前页面所有的link总数*/
For i = 1 To NumberOfLists-1
	linkName = Trim(Browser("百度一下,你就知道").Page("百度一下,你就知道").Link("micClass:=Link","index:="&i).GetRoProperty("innertext"))
	msgbox linkName
Next

猜你喜欢

转载自284772894.iteye.com/blog/2158921
QTP
今日推荐