Watir-webdriver checks the size and number of columns in a table

I am starting the process of converting my WATIR scripts to use the WATIR webdriver. There are several table methods that I used in my WATIR scripts to check the size (rows and columns) of an HTML table.

myTable.row_count myTable.column_count 

These methods do not exist in webdriver, so I'm looking for a good way to perform the same check.

For rows, this seems to give the same result as the row_count method

 myTable.rows.length 

In the column column of the table, I tried to convert the table to an array of strings and get the length of the first row, but converting to a string array takes some time.

 myCols = myTable.strings[0].length 

Can anyone suggest a better / faster way to get the size of the table?

+6
source share
1 answer

Assuming the first row has the correct number of cells:

  table.row.cells.length 
+7
source

Source: https://habr.com/ru/post/887818/


All Articles