51Testing软件测试论坛

标题: 取出Link的text值 [打印本页]

作者: snyygyso2005    时间: 2008-11-10 12:33
标题: 取出Link的text值
[attach]46743[/attach]
每次单击“检索”按钮,搜索结果都不一样,我想把搜索结果输出,Browser("www.subconchina.com").Page("买家检索_2").Link("搜索结果( 7 )").Output CheckPoint("搜索结果"),用这个,只能记录第一次,以后单击“检索”后,QTP都无法找到超连接
作者: jifeng    时间: 2008-11-10 18:12
把问题的提示贴出来。

用其他属性去识别对象,由于每次结果不一样,所以你用录制是的属性去识别肯定会出问题的。找一下对象的一个通用的属性,然后改一下语句。
作者: kaa    时间: 2008-11-10 20:02
懂得对象识别机制和正则表达式,就很快能解决了。

把text属性加到description Properties中, 值改成"^搜索结果"  就可以了。
作者: 假装不在    时间: 2008-11-11 00:25
::yiwusuoyou:::
a=Browser("www.subconchina.com").Page("买家检索_2").Link("outertext :=搜索结果*","index:=0").getroproperty("outertext")
b= Mid(a,instr(a,"(")+1,instr(a,")")-instr(a,"(")-1)
MsgBox Trim( b)
作者: snyygyso2005    时间: 2008-11-11 16:22
谢谢 假装不在
根据你的提示,终于把问题给解决了,但是在识别对象时,index属性才起到了作用,outertext没有起到作用的。
我是一个一个的试才把index属性给找到的,大家还有没有什么方法,可以把link的index属性取出来
作者: 假装不在    时间: 2008-11-11 17:48
"text:="




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