如何解决我们如何在空手道中获取存储在 <div> 表中的多个数据?
我试图从使用 <div>
标签存储/制作的网络表中获取数据集,而不是像传统的 html 数据表。例如:
<div class="tabulator-cell" role="gridcell" tabulator-field="program_name" title="" style="width: 135px; text-align: left; height: 30px;">
<span style="color: #00def; font-weight: 500;">Consumer xyz</span>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="business_val" title="" style="width: 119px; text-align: center; height: 00px;">
11898
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
因此,我为此使用了 scriptAll() 方法,并且只需要此处“消费者 xyz”的数据,但无法这样做。
* def list = scriptAll('div div','_.textContent',function(x){ return x.contains('Consumer xyz') })
* delay(3000)
* print list
对此的任何帮助将不胜感激。提前致谢。
解决方法
我只是给你一个提示。这是获取对行的父级 div
的引用的方法:
* def temp = locate('{}Consumer Banking').parent.parent
现在由您决定:
* def businessValue = temp.locate("[tabulator-field='business_value']")
* match businessValue.text.trim() == '11898'
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。