yandex-qatools / htmlelements

Html Elements is a Java framework providing easy-to-use way of interaction with web-page elements in web-page tests.
Other
271 stars 116 forks source link

Ability to find elements in Class Table shall be improved #117

Closed IgorBM closed 8 years ago

IgorBM commented 8 years ago

I have to test a table with the following structure:

<table>
     <thead>
        <tr>
           <th/>
           <th/>
           ....
           <th/>
        </tr>
    <thead/>
    <tfoot>
        <tr>
           <td/>
        </tr>  
   </tfoot>
  <tbody>
        <tr>
           <td/>
           <td/>
           ....
           <td/>
        </tr>
  </tbody>

Thus, when I declare it like:

  @FindBy(xpath = "//table")
    private Table rosterTable;

In case of empty table with a single row to be filled, I've got 3 rows - one for header, one for footer, 8 for tbody and it fails with this error on the line 143 in Table.java:

        for (List<WebElement> row : rows) {
            if (row.size() != headings.size()) {
                throw new HtmlElementsException("Headings count is not equal to number of cells in row");
            }

Could you introduce some flexibility to handle such table structures, so rows are being located under tbody, for example?

artkoshelev commented 8 years ago

I can't find code you are talking about in htmlelements codebase. Which version do you use?

IgorBM commented 8 years ago

Sorry. It seems I was using the version 1.14 and in 1.15 you have resolved this issue already. Thanks for the hint!