定位特定tag下的元素?
如下黑体字的"pick me 1","pick me 2","pick me 3"等 (只存在与<form>里) 是需要取得的字符串,我想遍历整个页面的span,然后把span里的innertext(即pick me 1/2/3...)存入一个数组。但这个方法同时把页面中其他span里的 "干扰1、2、3" 等没用的字符串也都一起取得了。因为我想写一个公共function来检查所有这类页面里的元素,所以class, id 等tag的值全都不确定。有没有什么办法能只取 form 里的 span 呢?请各位高手指教!谢谢!<span class="abc">干扰1</span>
<span class="bcd">干扰2</span>
干扰3等...
<form accept-charset="UTF-8" action="/aaa/31" class="form" id="edit" method="post">
<span>
<label class="label show_one" for="name_pick1">Name:</label>
pick me 1
</span>
<span>
<label class="label show_two" for="name_pick2">Name:</label>
pick me 2
</span>
pick me 3等...
</form>
==============用于检测pick me字符串的部分代码====================
Set ob = Description.Create()
ob("micclass").value = "WebElement"'2)用span别忘加这句
ob("html tag").value = "SPAN"
Set obj = Browser("title:=.*").Page("title:=.*").childobjects(ob)
For i = 0 to obj.count-1
lineItem = obj(i).GetROProperty("innertext") 'lineItem被赋予的值包含干扰字符串
Next
页:
[1]