我无法获取具有延迟加载的数据表的xpath以计算行数
<div class="dataTables_scrollBody" style="position: relative; overflow: auto; width: 100%; height: 369px; min-height: 0px;">
<table id="offers_table" class="display article-list ranklist_drag table table-bordered dataTable no-footer" aria-describedby="offers_table_info" role="grid" style="position: absolute; top: 0px; left: 0px; width: 100%;" width="100%" cellspacing="0">
<thead>
<tbody>
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
<tr class="odd" role="row">
<tr class="even" role="row">
</tbody>
</table>
的问候, Apurva
答案 0 :(得分:0)
计算表格中的行数:
driver.findElements(By.cssSelector("#offers_table tbody tr[role='row']")).size()
或xpath:
String xpath = By.xPath("//table[@id='offers_table']//tbody//tr[@role='row']");
driver.findElements(xpath).size()