51Testing软件测试论坛
标题:
求助——关于元素定位find_element_by_link_text
[打印本页]
作者:
qingyun_0922
时间:
2018-5-17 14:07
标题:
求助——关于元素定位find_element_by_link_text
本帖最后由 qingyun_0922 于 2018-5-17 14:16 编辑
各位大牛好,我现在想自动化测试一个下拉框选择项,有谁有这方面的相关经验吗?
我现在是想这么做,通过二次定位获取到下拉框的所有选项,存到一个list里面,然后随机取其中一个值,根据这个值的文本去获取到元素,然后去点击,之后再在获取下拉框的值去 判定。
但现在比较尴尬,现在通过文本获取元素是失败的,我用的是
find_element_by_link_text (),有谁有什么经验的吗?
作者:
Real_小T
时间:
2018-5-17 22:06
下拉框的前端代码贴一下
作者:
qingyun_0922
时间:
2018-5-21 14:47
<div class="k-list-container k-popup k-group k-reset" id="caseStatus-list" data-role="popup" style="height: 200px; display: none; font-size: 12px; font-family: 微软雅黑, "Segoe UI", "Lucida Grande", Helvetica, Arial, "Microsoft YaHei", FreeSans, Arimo, "Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3", Arial, sans-serif; font-stretch: 100%; font-style: normal; font-weight: 400; line-height: normal; width: 199px; transform: translateY(204px); position: absolute;"><ul unselectable="on" class="k-list k-reset" tabindex="-1" role="listbox" aria-hidden="true" id="caseStatus_listbox" aria-live="off" style="overflow: auto; height: 198px;"><li tabindex="-1" role="option" unselectable="on" class="k-item">全部</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已出警</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已受理</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已立案</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已破案</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已结案</li><li tabindex="-1" role="option" unselectable="on" class="k-item k-state-selected k-state-focused" id="caseStatus_option_selected" aria-selected="true">已销案</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已不立</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已转交</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已破未结</li><li tabindex="-1" role="option" unselectable="on" class="k-item">撤案转行政处罚</li><li tabindex="-1" role="option" unselectable="on" class="k-item">不受理</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已调解</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已终止</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已总结</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已处罚</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已受理未结</li><li tabindex="-1" role="option" unselectable="on" class="k-item">当场处罚</li><li tabindex="-1" role="option" unselectable="on" class="k-item">审查中</li><li tabindex="-1" role="option" unselectable="on" class="k-item">已审查</li><li tabindex="-1" role="option" unselectable="on" class="k-item">其它</li></ul></div>
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2