前言
如何获取table内容动态tr和td的dom对象,今天给大家总结了方法。
获取table中DOM元素方法总结
1 | <table id="projectstatus" class="sortable pane bigtable stripped-odd"><tbody><tr class="header"><th tooltip="上次构建状态" title="上次构建状态"><a href="#" class="sortheader"> S<span class="sortarrow"> </span></a></th><th tooltip="构建晴雨表" title="构建晴雨表"><a href="#" class="sortheader"> W<span class="sortarrow"> </span></a></th><th initialsortdir="down"><a href="#" class="sortheader">名称<span class="sortarrow"> ↓</span></a></th><th><a href="#" class="sortheader">上次成功<span class="sortarrow"> </span></a></th><th><a href="#" class="sortheader">上次失败<span class="sortarrow"> </span></a></th><th><a href="#" class="sortheader">上次持续时间<span class="sortarrow"> </span></a></th><th width="1"><a href="#" class="sortheader"> <span class="sortarrow"> </span></a></th><th><a href="#" class="sortheader"> <span class="sortarrow"> </span></a></th></tr><tr id="job_FCA玛莎拉蒂自动化测试" class=" job-status-blue"><td data="4"><img src="/static/ecc2f937/images/24x24/blue.png" alt="成功" tooltip="成功" style="width: 24px; height: 24px; " class="icon-blue icon-md" title="成功"></td><td data="100" class="healthReport" onmouseover="this.className='healthReport hover';return true; |
1.获取动态tr个数
1 | describe('处理table方法总结', function () { |
2.获取动态tr去断言td内容
1 | describe('处理table方法总结', function () { |
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家的支持。
更多文章关注小编公众号:自动化测试 To share