/** * 获取<thead>元素 * * @return */ private WebElement getTHead() { if (null == this.thead) { try { this.thead = this.findElement(By.xpath(HtmlTags.THEAD)); } catch (NotFoundException ex) { if (this.logger.isDebugEnabled()) { this.logger.debug(ex.getMessage(), ex); } } } return this.thead; }
/** * 获取<tfoot>元素 * * @return */ private WebElement getTFoot() { if (null == this.tfoot) { try { this.tfoot = this.findElement(By.xpath(HtmlTags.TFOOT)); } catch (NotFoundException ex) { if (this.logger.isDebugEnabled()) { this.logger.debug(ex.getMessage(), ex); } } } return this.tfoot; }
/** * 获取<tbody>元素 * * @return */ private WebElement getTBody() { if (null == this.tbody) { try { this.tbody = this.findElement(By.xpath(HtmlTags.TBODY)); } catch (NotFoundException ex) { if (this.logger.isDebugEnabled()) { this.logger.debug(ex.getMessage(), ex); } } } return this.tbody; }
@Override public List<ITableRow> findBodyRows(ITableRowLocator locator) { List<ITableRow> result = new ArrayList<ITableRow>(); for (int i = 0; ; i++) { ITableRow row = null; try { row = this.getBodyRow(i); } catch (NotFoundException ex) { if (this.logger.isDebugEnabled()) { this.logger.debug(ex.getMessage(), ex); } // 代表超过行数了 break; } if (locator.isTarget(row)) { result.add(row); } } return result; }