51Testing软件测试论坛

标题: selenium怎么定位combo-arrow combo-arrow-hover的页面元素 [打印本页]

作者: zhouguangying    时间: 2015-1-21 16:14
标题: selenium怎么定位combo-arrow combo-arrow-hover的页面元素
本帖最后由 zhouguangying 于 2015-1-21 16:28 编辑

代码一:
<div class="edit-row">
<div class="for-name" for="Structure">建筑结构</div>
<div class="for-value">
<input id="building" class="combogrid-f combo-f" type="text" data-bind="value:dto.StructureName" style="display: none; width: 150px;"/>
<span class="combo" style="width: 150px;">
<input class="combo-text validatebox-text" type="text" autocomplete="off" style="width: 130px; height: 20px; line-height: 20px;" data-original-title="" title=""/>
<span>
<span class="combo-arrow combo-arrow-hover" style="height: 20px;"/>
</span>
<input class="combo-value" type="hidden" value=""/>
</span>
</div>
</div>

代码二:
<div class="edit-row">
<div class="for-name" for="EstateName">房产编号</div>
<div class="for-value">
<input id="estate" class="combogrid-f combo-f" type="text" data-bind="value:dto.EstateName" style="display: none; width: 150px;"/>
<span class="combo" style="width: 150px;">
<input class="combo-text validatebox-text" type="text" autocomplete="off" style="width: 130px; height: 20px; line-height: 20px;" data-original-title="" title=""/>
<span>
<span class="combo-arrow combo-arrow-hover" style="height: 20px;"/>
</span>
<input class="combo-value" type="hidden" value=""/>
</span>
</div>
</div>
怎么查到两段代码中combo-arrow combo-arrow-hover的页面元素,因为这个是下拉框,同一个页面上有多处都是一样的,用firfoxbug通过xpath定位的都是一样的,请哪位大神帮忙
作者: jaychang1989    时间: 2015-1-22 13:11
可以从<div class="for-name" for="Structure">建筑结构</div>来区分,然后再找子项
作者: 风的消息    时间: 2015-1-22 21:26
先找到他们在不同的div下然后,一层层往下找
作者: zhouguangying    时间: 2015-1-27 15:53
谢谢楼上,已经解决
作者: Sivler    时间: 2015-1-27 20:28
请教 楼上的是怎么解决的?




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